码迷,mamicode.com
首页 > 数据库 > 详细

centos中 mysql 5.7安装

时间:2016-11-15 13:31:31      阅读:241      评论:0      收藏:0      [点我收藏+]

标签:sys   密码连接   font   inf   reg   mysqld   模式   blog   cti   

 以免授权模式启动

编辑 /etc/my.cnf,添加以下内容:

 linux环境中:vi /etc/my.cnf

在[MySQL(和PHP搭配之最佳组合)d]配置段添加如下两行:

user=mysql

skip-grant-tables

保存退出编辑。

重新启动 mysqld.

service mysqld restart

使用 mysql免密码连接,修改密码和密码过期标志;

[root@iZm5ei4m ~]# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.16 MySQL Community Server (GPL)

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> select user();

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.00 sec)

mysql> select user();
+--------+
| user() |
+--------+
| root@  |
+--------+
1 row in set (0.00 sec)

mysql>UPDATE mysql.user SET authentication_string=PASSWORD(wajuejishu@34!),password_expired=N where USER=root;
Query OK, 1 rows affected, 0 warning (0.00 sec)
mysql> exit
Bye

正常连接:

[root@iZm5ei4mxt5qb65ldoxpywZ ~]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.16 MySQL Community Server (GPL)

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>

  

centos中 mysql 5.7安装

标签:sys   密码连接   font   inf   reg   mysqld   模式   blog   cti   

原文地址:http://www.cnblogs.com/diylab/p/6065133.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!