標籤: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免密碼串連,修改密碼和密碼到期標誌;
[[email protected] ~]# mysqlWelcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 3Server 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 itsaffiliates. Other names may be trademarks of their respectiveowners.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() |+--------+| [email protected] |+--------+1 row in set (0.00 sec)mysql>UPDATE mysql.user SET authentication_string=PASSWORD(‘[email protected]!‘),password_expired=‘N‘ where USER=‘root‘;Query OK, 1 rows affected, 0 warning (0.00 sec)mysql> exitBye
正常串連:
[[email protected] ~]# mysql -u root -pEnter password:Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 3Server 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 itsaffiliates. Other names may be trademarks of their respectiveowners.Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.mysql>
centos中 mysql 5.7安裝