您的位置:首页 > 运维架构 > Linux

centos安装mysql5.7

2015-12-07 01:00 519 查看
安装很容易的

yum install mysql-community-server
service mysqld restart
登陆的时候就坑了,以前都是没有密码的,结果就出事了

[root@c02 ~]# mysql
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
结果是因为mysql为了安全设置了个随机密码,要手动查看

[root@c02 ~]# grep "password" /var/log/mysqld.log
2015-12-06T16:08:10.547239Z 1 [Note] A temporary password is generated for root@localhost: uGKNd<I04+?k
对这个uGKNd<I04+?k就是密码,用这个密码登陆,果然就成功了

[root@c02 ~]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 5.7.9

Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> exit
Bye
[root@c02 ~]#
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: