yum - linux7.0安装mysql的问题

查看:140
本文介绍了yum - linux7.0安装mysql的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问 题

安装mysql

# wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
# rpm -ivh mysql-community-release-el7-5.noarch.rpm
# yum install mysql-community-server

启动mysql
service mysqld restart
设置密码

[root@YFPUNzLr ~]# mysql -uroot
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

可我没设置密码啊,网上找了几个方式都没用。

解决方案

网上找到的有效答案:
密码在/var/log/mysqld.log这个文件里
可以用grep 'temporary password' /var/log/mysqld.log来查询,也可以自己在文件里找。

[root@YFPUNzLr ~]# grep 'temporary password' /var/log/mysqld.log
2017-02-15T14:31:05.449058Z 1 [Note] A temporary password is generated for root@localhost: 3NeI3PuNwa%j
[root@YFPUNzLr ~]# mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 5.7.17

Copyright (c) 2000, 2016, 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> 

这篇关于yum - linux7.0安装mysql的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆