Mysql卸载

yum remove mysql mysql-server mysql-libs compat-mysql51

rm -rf /var/lib/mysql

rm /etc/my.cnf

查看是否还有mysql软件:

rpm -qa|grep mysql

有的话继续删除





Mysql安装

1>若本地没有安装包 能够考虑使用yum命令进行下载

# yum -y install mysql-server

# yum -y install php-mysql

2>安装后,MySQL自己主动启动,默认没实username和password,设置新password

#   /usr/bin/mysqladmin -u root password 'aaaaaa'

[root@luozhonghua ~]#   /usr/bin/mysqladmin -u root password 'aaaaaa'

/usr/bin/mysqladmin: connect to server at 'localhost' failed

error: 'Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)'

Check that mysqld is running and that the socket: '/var/lib/mysql/mysql.sock' exists!

解决:

2.1》/etc/rc.d/init.d/mysqld status 看看mysql是否已经启动

3.2》service mysqld start

3>登录MySQL

>mysql -u root -p

enter password:’aaaaaa’





4>赋权连接的主机

#grant select,insert,update,delete on *.* to root@192.168.1.101  identified by 'aaaaaa'

grant select,insert,update,delete on *.* to root@127.0.0.1  identified by 'aaaaaa';









5>更改默认字符集

# cp my-medium.cnf  /etc/my.cnf

在[client]下增加 default-character-set=utf8

在[mysqld]下增加 default-character-set=utf8

查找安装路径

Rpm -qa | grep mysql

Rpm -ql 包名

[root@luozhonghua charsets]# find /usr -name my-medium.cnf

/usr/share/doc/mysql-server-5.1.73/my-medium.cnf

/usr/share/mysql/my-medium.cnf





#6>设置mysql开机自启动

# vi /etc/rc.local

增加例如以下一行

#/usr/share/mysql/mysql.server start

7>又一次启动MySQL

# /etc/init.d/mysql restart

service mysqld restart





8>測试;





[root@luozhonghua ~]# mysql -u root -p

Enter password:

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 3

Server version: 5.1.73 Source distribution





Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.





Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.





Type 'help;' or '\h' for help. Type '\c' to clear the current input statement                                                                                .





mysql> create database xxx

    -> ;

Query OK, 1 row affected (0.06 sec)





mysql> ls

    -> ;

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual th                                                                                at corresponds to your MySQL server version for the right syntax to use near                        
                                                        'ls' at line 1

mysql> show databases

    -> ;

+--------------------+

| Database           |

+--------------------+

| information_schema |

| mysql              |

| test               |

| xxx                |

+--------------------+

4 rows in set (0.06 sec)





mysql> use xxx;

Database changed

mysql> show database

    -> ;

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual th                                                                                at corresponds to your MySQL server version for the right syntax to use near                        
                                                        'database' at line 1

mysql> show databases;

+--------------------+

| Database           |

+--------------------+

| information_schema |

| mysql              |

| test               |

| xxx                |

+--------------------+

4 rows in set (0.01 sec)





mysql> use xxx;

Database changed

mysql> create table test(

    -> int id not null,

    -> varchar(20) name null);

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual th                                                                                at corresponds to your MySQL server version for the right syntax to use near                        
                                                        'int id not null,

varchar(20) name null)' at line 2

mysql> show tables;

Empty set (0.00 sec)





mysql> create table dbtest (

    -> id int ,

    -> name varchar);

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual th                                                                                at corresponds to your MySQL server version for the right syntax to use near                        
                                                        ')' at line 3

mysql> create table dbtest (

    -> id int,

    -> name varchar(10));

Query OK, 0 rows affected (0.07 sec)





mysql> show tables;

+---------------+

| Tables_in_xxx |

+---------------+

| dbtest        |

+---------------+

1 row in set (0.01 sec)





mysql> drop table xxx;

ERROR 1051 (42S02): Unknown table 'xxx'

mysql> drop table dbtest;

Query OK, 0 rows affected (0.00 sec)





mysql> ls

    -> ;

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual th                                                                                at corresponds to your MySQL server version for the right syntax to use near                        
                                                        'ls' at line 1

mysql> show tables;

Empty set (0.00 sec)





mysql>

linux mysql 卸载,安装,測试全过程的更多相关文章

  1. linux mysql 卸载与安装及配置命令

    1.RPM包安装方式的MySQL卸载 1) 检查是否安装了MySQL组件. # rpm -qa | grep -i mysql 2)卸载前关闭MySQL服务 # service mysql statu ...

  2. linux mysql查看安装信息

    ps -ef|grep mysql root               ?        :: /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mys ...

  3. linux mysql默认安装在哪个目录

    MySQL安装完成后不象SQL Server默认安装在一个目录,它的数据库文件.配置文件和命令文件分别在不同的目录,了解这些目录非常重要,尤其对于Linux的初学者,因为 Linux本身的目录结构就比 ...

  4. MySQL卸载安装8.0.*

    一.卸载 1. 本人安装目录在C盘Program Files文件中(删除MySQL文件夹) 2. 找到C盘Program Data隐藏文件夹中的MySQL并删除(删除提示MySQL在运行的话可以去任务 ...

  5. redis-3.0.3安装測试

    $ tar xzvf redis-3.0.3.tar.gz $ cd redis-3.0.3 $ make     //编译 编译完毕进行 $ make test 命令測试 得到例如以下错误信息: c ...

  6. Linux下卸载安装mysql

    1.卸载命令:# rpm -qa |grep -i mysql # yum remove mysql-community mysql-community-server mysql-community- ...

  7. linux - mysql - 卸载:使用rpm方式安装的mysql

    一.查看系统中是否以rpm包安装的mysql rpm -qa | grep -i mysql 结果: 备注:如果有内容则证明是使用rpm方式安装的mysql 二.卸载 使用rpm -e 命令将上个命令 ...

  8. linux - mysql - 卸载:RPM包安装方式的MySQL卸载

    (1)检查是否安装了MySQL组件 [root@DB-Server init.d]# rpm -qa | grep -i mysql MySQL-devel-5.6.23-1.linux_glibc2 ...

  9. linux mysql数据库安装(tar.gz)

    概述 mysql数据库在linux下可以充分发挥威力,mysql数据库越来越受到软件公司的青睐,为什么呢? 免费.跨平台.轻.支持多并发 在北京很多软件公司属于创业型的中.小公司,从节约成本的角度考虑 ...

随机推荐

  1. [Javascirpt AST] Babel Plugin -- create new CallExpression

    The code we want to trasform: 2 ** 3; a ** b; a **b * c; a ** b ** c; (a+1) ** (b+1); transform to: ...

  2. Xcode7 的两个小坑

    Xcode7 还在 beta.时不时崩一下什么的倒也是预料之中的事.没料到的是之前用着好好的,今天升完 El Capitan 之后,模拟器竟然不见了,设备倒是在 schema 栏右边里能看到.只是注明 ...

  3. Linux下读写寄存器

    arm裸机下读写寄存器很容易,各个寄存器和内存的地址是单一地址空间,他们是用相同的指令进行读写操作的.而在linux下就要复杂很多,因为linux支持多个体系架构的CPU.比如arm和x86就不一样, ...

  4. js原生代码实现鼠标拖拽(超简单)

    首先先来看这一张图 在这种图中,盒子的大小为512px,并且margin-left:-250px margin-top:140px;并通过一些样式让其在中部显示 这些样式都不是重要的,这里加个marg ...

  5. Cocos2d 游戏状态机

    加cocos2d 是标题党. 事实上跟cocos2d无关. 1.游戏背景介绍 比方有这么一个"记忆"类的比赛游戏.你和电脑对战.轮到谁的回合,谁翻两张牌.假设两张牌一样,就消掉这两 ...

  6. Android Material风格的应用(三)--DrawerLayout

    添加抽屉导航 Android Material风格的应用(一)--AppBar TabLayoutAndroid Material风格的应用(二)--RecyclerViewAndroid Mater ...

  7. Fiddler抓包工具详细介绍

    本文转自:http://www.cnblogs.com/Chilam007/p/6985379.html 一.Fiddler与其他抓包工具的区别 1.Firebug虽然可以抓包,但是对于分析http请 ...

  8. x264代码剖析(十五):核心算法之宏块编码中的变换编码

    x264代码剖析(十五):核心算法之宏块编码中的变换编码 为了进一步节省图像的传输码率.须要对图像进行压缩,通常採用变换编码及量化来消除图像中的相关性以降低图像编码的动态范围.本文主要介绍变换编码的相 ...

  9. 为什么通过空指针(NULL)能够正确调用类的部分成员函数

    #include <iostream> using namespace std; class B { public: void foo() { cout << "B ...

  10. Oracle数据库(三)

    专题一:oracle查询 1.where查询 查询部门编号是1的部门信息 ; 查询姓名是kw的员工,字符串使用‘’,内容大小写敏感 select *from emp where name='kw' 查 ...