rhel6.4 安装 mysql-5.6
下载(临时地址, 如不可用,请到oracle官网下载)
采用rpm安装. mysql服务端要安装:
ftp://pepstack.com/pub/rpm/MySQL-server-5.6.27-1.el6.x86_64.rpm
mysql客户端要安装:
ftp://pepstack.com/pub/rpm/MySQL-client-5.6.27-1.el6.x86_64.rpm
ftp://pepstack.com/pub/rpm/MySQL-devel-5.6.27-1.el6.x86_64.rpm
服务端安装过程:
删除旧的:
# rpm -qa | grep -i mysql
mysql-libs-5.1.66-2.el6_3.x86_64
# rpm -ev --nodeps mysql-libs-5.1.66-2.el6_3.x86_64
慎重: 可能需要删除旧的文件(如果有):
# rm -f /etc/my.cnf
# rm -rf /usr/var/lib/mysql
安装新版本:
# rpm -ivh ./MySQL-server-5.6.27-1.el6.x86_64.rpm
客户端安装过程:
# rpm -ivh ./MySQL-client-5.6.27-1.el6.x86_64.rpm
# rpm -ivh ./MySQL-devel-5.6.27-1.el6.x86_64.rpm
服务端启动和登录:
# service mysql start
# mysql -u root
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
解决此错误:
1 停止mysql服务:
# service mysql stop
2 启动mysql服务,跳过验证:
# mysqld_safe --skip-grant-tables&
3 登录mysql:
# mysql --user=root mysql
4 设置root用户密码:
mysql > update user set Password=PASSWORD('abcd1234');
mysql > flush privileges;
mysql > exit;
5 现在可以杀死mysqld_safe进程:
# killall mysqld_safe&
6 重启mysql服务:
# service mysql start
查看端口:
# netstat -nat | grep 3306
客户端登录(ipaddr为mysql服务所在的服务器ip地址):
# mysql -u root -h ipaddr -pabcd1234