标签: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>
标签:sys 密码连接 font inf reg mysqld 模式 blog cti
原文地址:http://www.cnblogs.com/diylab/p/6065133.html