安装mysql5.6
1、准备yum
wget http://repo.mysql.com/mysql-community-release-el6-5.noarch.rpm
rpm -ivh mysql-community-release-el6-5.noarch.rpm
yum repolist all | grep mysql
2、安装
yum install mysql-community-server -y
3、 service mysqld start //启动mysql
4、 mysqladmin -u root password '123456' //设置用户密码
5、设置mysql用户
mysql> use mysql;
mysql> update user set password=password('123') where user='root' and host='localhost';
mysql> flush privileges;
6、chkconfig mysqld on //设置开机启动
7、chkconfig --list | grep mysql //查看开机启动状态
8、GRANT ALL PRIVILEGES ON *.* TO root@'%' IDENTIFIED BY '123456' WITH GRANT OPTION; //进入mysql执行该命令,允许远程连接
卸载mysql
1、卸载程序
rpm -qa|grep -i mysql // 查看安装过的mysql
rpm -ev MySQL-client-5.5.25a-1.rhel5 //卸载查看列表中的结果
rpm -ev MySQL-client-5.5.25a-1.rhel5 --nodeps //如果卸载报错,就使用该强制卸载命令
rpm -e --noscripts MySQL-client-5.5.25a-1.rhel5 //如果还报错,就试试这个命令
2、查找目录,删除目录下的所有文件
find / -name mysql //查找有关mysql的所有文件
rm -rf /var/lib/mysql //一个一个的移除查找结果下的文件
3、删除配置文件
rm -rf /etc/my.cnf //删除不在上面列表中的配置文件
4、检验是否完成卸载
find / -name mysql
rpm -qa|grep -i mysql
都为空则完成