前期准备
查看mysql安装路径
[root@root mysql-5.6.12]# whereis mysql
mysql: /usr/lib64/mysql /usr/local/mysql /usr/share/mysql
查看mysql安装包
[root@root mysql-5.6.12]# rpm -qa|grep mysql
mysql-libs-5.1.73-5.el6_6.x86_64
mysql-server-5.1.73-5.el6_6.x86_64
卸载mysql
[root@root mysql-5.6.12]# yum remove mysql
[root@localhost ~]# yum remove mysql*
安装
下载mysql的yum源包
上传
[root@localhost ~]# yum localinstall mysql-community-release-el6-5.noarch.rpm
[root@localhost ~]# yum install mysql-server
启动mysql
[root@localhost ~]# service mysqld start
设置密码
[root@localhost ~]# /usr/bin/mysqladmin -u root password 'new-password'
远程连接授权
首先关闭防火墙
[root@localhost ~]# service iptables stop
此时使用远程工具连接发现:
授权
GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'%' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;
注意:'myuser'、'mypassword' 需要替换成实际的用户名和密码。
测试: