2016-02-08 49 views
0

Linux版本的:Ubuntu的LTS 14.04.1服務器 版本:5.7.11 MySQL社區服務器(GPL)從下面的鏈接下載 : http://dev.mysql.com/downloads/repo/apt/的MySQL 5.7.11 mysql_secure_installation不工作

當我嘗試運行mysql_secure_installation 我設置了密碼並重新加載了所有完成的任務。 但是當我嘗試登錄mysql時,它不需要root用戶的密碼。

>>>mysql 


mysql> select * from user; 
+-----------+-----------+-------------+-------------+-------------+---- ---------+-------------+-----------+-------------+---------------+--------------+-----------+------------+-----------------+------------+------------+--------------+------------+-----------------------+------------------+--------------+-----------------+------------------+------------------+----------------+---------------------+--------------------+------------------+------------+--------------+------------------------+----------+------------+-------------+--------------+---------------+-------------+-----------------+----------------------+-----------------------+-------------------------------------------+------------------+-----------------------+-------------------+----------------+ 
| Host  | User  | Select_priv | Insert_priv | Update_priv | Delete_priv | Create_priv | Drop_priv | Reload_priv | Shutdown_priv | Process_priv | File_priv | Grant_priv | References_priv | Index_priv | Alter_priv | Show_db_priv | Super_priv | Create_tmp_table_priv | Lock_tables_priv | Execute_priv | Repl_slave_priv | Repl_client_priv | Create_view_priv | Show_view_priv | Create_routine_priv | Alter_routine_priv | Create_user_priv | Event_priv | Trigger_priv | Create_tablespace_priv | ssl_type | ssl_cipher | x509_issuer | x509_subject | max_questions | max_updates | max_connections | max_user_connections | plugin    | authentication_string      | password_expired | password_last_changed | password_lifetime | account_locked | 
+-----------+-----------+-------------+-------------+-------------+-------------+-------------+-----------+-------------+---------------+--------------+-----------+------------+-----------------+------------+------------+--------------+------------+-----------------------+------------------+--------------+-----------------+------------------+------------------+----------------+---------------------+--------------------+------------------+------------+--------------+------------------------+----------+------------+-------------+--------------+---------------+-------------+-----------------+----------------------+-----------------------+-------------------------------------------+------------------+-----------------------+-------------------+----------------+ 
| localhost | root  | Y   | Y   | Y   | Y   | Y   | Y   | Y   | Y    | Y   | Y   | Y   | Y    | Y   | Y   | Y   | Y   | Y      | Y    | Y   | Y    | Y    | Y    | Y    | Y     | Y     | Y    | Y   | Y   | Y      |   |   |    |    |    0 |   0 |    0 |     0 | auth_socket   |           | N    | 2016-02-08 15:54:07 |    NULL | N    | 
| localhost | mysql.sys | N   | N   | N   | N   | N   | N   | N   | N    | N   | N   | N   | N    | N   | N   | N   | N   | N      | N    | N   | N    | N    | N    | N    | N     | N     | N    | N   | N   | N      |   |   |    |    |    0 |   0 |    0 |     0 | mysql_native_password | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE | N    | 2016-02-08 15:54:08 |    NULL | Y    | 
+-----------+-----------+-------------+-------------+-------------+-------------+-------------+-----------+-------------+---------------+--------------+-----------+------------+-----------------+------------+------------+--------------+------------+-----------------------+------------------+--------------+-----------------+------------------+------------------+----------------+---------------------+--------------------+------------------+------------+--------------+------------------------+----------+------------+-------------+--------------+---------------+-------------+-----------------+----------------------+-----------------------+-------------------------------------------+------------------+-----------------------+-------------------+----------------+ 
2 rows in set (0.00 sec) 

沒有任何密碼要求?

我不知道爲什麼?

+0

你可以嘗試在mysql中設置密碼'UPDATE user SET Password = PASSWORD('YOURNEWPASSWORD')WHERE User ='root'; FLUSH PRIVILEGES;退出;' – Matt

+0

@Matt ERROR 1054(42S22):'字段列表'中的未知列'密碼'。 – nooper

+0

哎呀,思考舊版本。 'ALTER USER'root'@'localhost'IDENTIFIED BY'MyNewPass';' – Matt

回答

1

我覺得問題應該是mysql.user中的plugin這個列,變量名是auth_socket。

https://dev.mysql.com/doc/refman/5.7/en/pluggable-authentication.html https://dev.mysql.com/doc/mysql-security-excerpt/5.5/en/socket-authentication-plugin.html

如果我想改變mysql用戶的身份驗證,請按照下面的步驟。

ALTER USER 'root'@'localhost' IDENTIFIED with mysql_native_password; 
ALTER USER 'root'@'localhost' IDENTIFIED BY 'password'; 
FLUSH PRIVILEGES; 

這應該是工作。