centos7 安装 mysql

时间:2017-04-12 05:03:24   收藏:0   阅读:234

参考了下面两个链接

http://www.centoscn.com/mysql/2016/0315/6844.html 链接A

http://www.cnblogs.com/starof/p/4680083.html 链接B


安装过程中还遇到了一个问题

无法安装mysql-InvalidGPGKeyfromfile:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

这里参考了

http://www.2cto.com/database/201701/586216.html 

即将文件/etc/yum.repos.d/mysql-community.repo中的gpgcheck=1改成gpgcheck=0即可.

这是为什么上面的文件与链接A中的文件内容不同的原因.


启动mysql

systemctl start  mysqld.service

初次安装mysql是root账户是没有密码,需要设置一下,

mysql -h localhost -u root -p进入mysql

设置密码的时候遇到了问题

mysql> set password for ‘root’@‘localhost’ = password(‘123456‘);
ERROR 1133 (42000): Can‘t find any matching row in the user table

解决方法

mysql> grant all on mysql.user to ‘root‘@‘%‘ identified by ‘password‘;
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> update mysql.user set password=password(‘123456‘) where user =‘root‘;
Query OK, 5 rows affected (0.00 sec)
Rows matched: 5  Changed: 5  Warnings: 0

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)


本文出自 “梦里不知身是客” 博客,请务必保留此出处http://tenfee.blog.51cto.com/6353835/1915007

原文:http://tenfee.blog.51cto.com/6353835/1915007

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!