centos7安装配置mysql5.6
Posted YSHY
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了centos7安装配置mysql5.6相关的知识,希望对你有一定的参考价值。
1. 下载mysql的repo源
$ wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
2. 安装mysql-community-release-el7-5.noarch.rpm包
$ sudo rpm -ivh mysql-community-release-el7-5.noarch.rpm
3. 安装mysql
$ sudo yum install mysql-server
问题1:
[[email protected] ~]$ mysql -u root
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!
[[email protected] ~]$
【解决方法】
sudo chown -R wzh:wzh /var/lib/mysql
service mysqld restart
问题2
[[email protected] ~]$ mysql -u root
ERROR 1045 (28000): Access denied for user ‘root‘@‘localhost‘ (using password: NO)
【解决方法】
vi /etc/my.cnf
在mysqld下面添加skip-grant-tables
service mysqld restart
--
use mysql;
update user set password=password("mysql") where user="root";
flush privileges;
--密码重设置成功,改好之后,再修改一下my.ini这个文件,把我们刚才加入的"skip-grant-tables"这行删除,保存退出再重启mysql服务就可以了。
以上是关于centos7安装配置mysql5.6的主要内容,如果未能解决你的问题,请参考以下文章