MySQL学习笔记2-System administration(set password)II
2017-06-21 23:24
453 查看
发现在5.7.18版本中,不能按照前面说的修改密码,可以按照下面的操作修改:
在第一个窗口执行:
[root@mysql mysql]# service mysqld stop
Stopping mysqld: [ OK ]
[root@mysql mysql]# /usr/bin/mysqld_safe --skip-grant-tables
2017-05-28T08:46:52.475840Z mysqld_safe Logging to '/var/log/mysqld.log'.
2017-05-28T08:46:52.506239Z mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql在第二个窗口执行:
The End.
在第一个窗口执行:
[root@mysql mysql]# service mysqld stop
Stopping mysqld: [ OK ]
[root@mysql mysql]# /usr/bin/mysqld_safe --skip-grant-tables
2017-05-28T08:46:52.475840Z mysqld_safe Logging to '/var/log/mysqld.log'.
2017-05-28T08:46:52.506239Z mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql在第二个窗口执行:
[root@mysql ~]# mysql Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 4 Server version: 5.7.18 MySQL Community Server (GPL) Copyright (c) 2000, 2017, 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> use mysql Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed mysql> set password for 'root'@'localhost' =password(''); ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement mysql> update user set password='' where user="root"; ERROR 1054 (42S22): Unknown column 'password' in 'field list' mysql> desc user -> ; +------------------------+-----------------------------------+------+-----+-----------------------+-------+ | Field | Type | Null | Key | Default | Extra | +------------------------+-----------------------------------+------+-----+-----------------------+-------+ | Host | char(60) | NO | PRI | | | | User | char(32) | NO | PRI | | | | Select_priv | enum('N','Y') | NO | | N | | | Insert_priv | enum('N','Y') | NO | | N | | | Update_priv | enum('N','Y') | NO | | N | | | Delete_priv | enum('N','Y') | NO | | N | | | Create_priv | enum('N','Y') | NO | | N | | | Drop_priv | enum('N','Y') | NO | | N | | | Reload_priv | enum('N','Y') | NO | | N | | | Shutdown_priv | enum('N','Y') | NO | | N | | | Process_priv | enum('N','Y') | NO | | N | | | File_priv | enum('N','Y') | NO | | N | | | Grant_priv | enum('N','Y') | NO | | N | | | References_priv | enum('N','Y') | NO | | N | | | Index_priv | enum('N','Y') | NO | | N | | | Alter_priv | enum('N','Y') | NO | | N | | | Show_db_priv | enum('N','Y') | NO | | N | | | Super_priv | enum('N','Y') | NO | | N | | | Create_tmp_table_priv | enum('N','Y') | NO | | N | | | Lock_tables_priv | enum('N','Y') | NO | | N | | | Execute_priv | enum('N','Y') | NO | | N | | | Repl_slave_priv | enum('N','Y') | NO | | N | | | Repl_client_priv | enum('N','Y') | NO | | N | | | Create_view_priv | enum('N','Y') | NO | | N | | | Show_view_priv | enum('N','Y') | NO | | N | | | Create_routine_priv | enum('N','Y') | NO | | N | | | Alter_routine_priv | enum('N','Y') | NO | | N | | | Create_user_priv | enum('N','Y') | NO | | N | | | Event_priv | enum('N','Y') | NO | | N | | | Trigger_priv | enum('N','Y') | NO | | N | | | Create_tablespace_priv | enum('N','Y') | NO | | N | | | ssl_type | enum('','ANY','X509','SPECIFIED') | NO | | | | | ssl_cipher | blob | NO | | NULL | | | x509_issuer | blob | NO | | NULL | | | x509_subject | blob | NO | | NULL | | | max_questions | int(11) unsigned | NO | | 0 | | | max_updates | int(11) unsigned | NO | | 0 | | | max_connections | int(11) unsigned | NO | | 0 | | | max_user_connections | int(11) unsigned | NO | | 0 | | | plugin | char(64) | NO | | mysql_native_password | | | authentication_string | text | YES | | NULL | | | password_expired | enum('N','Y') | NO | | N | | | password_last_changed | timestamp | YES | | NULL | | | password_lifetime | smallint(5) unsigned | YES | | NULL | | | account_locked | enum('N','Y') | NO | | N | | +------------------------+-----------------------------------+------+-----+-----------------------+-------+ 45 rows in set (0.00 sec) mysql> UPDATE user SET Password=PASSWORD('123456') where USER='root' and host='root' or host='localhost'; ERROR 1054 (42S22): Unknown column 'Password' in 'field list' mysql> UPDATE user SET authentication_string=PASSWORD('123456') where USER='root' and host='root' or host='localhost'; Query OK, 2 rows affected, 1 warning (0.01 sec) Rows matched: 2 Changed: 2 Warnings: 1 mysql> FLUSH PRIVILEGES; Query OK, 0 rows affected (0.00 sec) mysql> quit Bye [root@mysql ~]# /etc/init.d/mysqld restart Stopping mysqld: [ OK ] /usr/bin/mysqld_safe: line 515: cd: /root: Not a directory Starting mysqld: [ OK ] [root@mysql ~]# mysql -uroot -p123456 mysql: [Warning] Using a password on the command line interface can be insecure. Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 4 Server version: 5.7.18 Copyright (c) 2000, 2017, 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>
The End.
相关文章推荐
- MySQL学习笔记2-System administration(set password)
- MySQL学习笔记2-System administration(STOP or START MySQL)
- mysql中的IN和FIND_IN_SET的区别与应用——>mysql学习笔记
- MySQL学习7_You must SET PASSWORD before executing this statement解决方法
- 阿里云server改动MySQL初始password---Linux学习笔记
- MySQL学习笔记——ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
- MYSQL的select 学习笔记
- mysql学习笔记
- PHP学习笔记(2)----Mysql与PHP的整合[原创]
- [MDX学习笔记之五]优化Set操作——SUM中的CrossJoin
- uC/OS - II 之事件控制块学习笔记
- PHP与MYSQL交互函数表学习笔记
- System.Text.Encoding 学习笔记
- System.Object 学习笔记
- gcc 内嵌汇编的学习笔记 II
- Tomcat Mysql 。。。学习笔记
- PHP学习笔记(4)----Mysql用户密码的修改[原创]
- PHP学习笔记(4)----Mysql用户密码的修改[原创]
- cougaar学习笔记之---序列化Asset到MySQL中
- c#学习笔记(四) get-set