mysql第一次設定mysql密碼
[root@centos bin]# service mysqld stop
Shutting down MySQL.[ OK ]
[root@centos bin]# ./mysqld_safe --skip-grant-tables&
[1] 21267
[root@centos bin]# 2016-05-16T18:14:00.092388Z mysqld_safe Logging to '/soft/data//centos.err'.
2016-05-16T18:14:00.120089Z mysqld_safe Starting mysqld daemon with databases from /soft/data/
[root@centos bin]#
[root@centos bin]# mysql -u root mysql
-bash: mysql: command not found
[root@centos bin]# ./mysql -u root mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.12 Source distribution
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> update user set password=PASSWORD("root") where user='root';
ERROR 1054 (42S22): Unknown column 'password' in 'field list'
mysql>
mysql>
mysql>
mysql> use mysql
Database changed
mysql> update user set password=PASSWORD("root") where user='root';
ERROR 1054 (42S22): Unknown column 'password' in 'field list'
mysql>
mysql>
mysql>
mysql>
mysql> select user from user;
+-----------+
| user |
+-----------+
| mysql.sys |
| root |
+-----------+
2 rows in set (0.00 sec)
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 authentication_string=PASSWORD("root") where user='root';
Query OK, 1 row affected, 1 warning (0.03 sec)
Rows matched: 1 Changed: 1 Warnings: 1
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> exit
Bye
[root@centos bin]# service mysqld restart
Shutting down MySQL.2016-05-16T18:16:32.859231Z mysqld_safe mysqld from pid file /soft/data/mysql.pid ended
[ OK ]
Starting MySQL.[ OK ]
[1]+ Done ./mysqld_safe --skip-grant-tables
[root@centos bin]#
[root@centos bin]#
[root@centos bin]#
[root@centos bin]# mysql -u root -p root
-bash: mysql: command not found
[root@centos bin]# ./mysql -u root -p root
Enter password:
ERROR 1049 (42000): Unknown database 'root'
[root@centos bin]# ./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.12
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> exit
Bye
[root@centos bin]#
[root@centos bin]#
[root@centos bin]#
Shutting down MySQL.[ OK ]
[root@centos bin]# ./mysqld_safe --skip-grant-tables&
[1] 21267
[root@centos bin]# 2016-05-16T18:14:00.092388Z mysqld_safe Logging to '/soft/data//centos.err'.
2016-05-16T18:14:00.120089Z mysqld_safe Starting mysqld daemon with databases from /soft/data/
[root@centos bin]#
[root@centos bin]# mysql -u root mysql
-bash: mysql: command not found
[root@centos bin]# ./mysql -u root mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.12 Source distribution
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> update user set password=PASSWORD("root") where user='root';
ERROR 1054 (42S22): Unknown column 'password' in 'field list'
mysql>
mysql>
mysql>
mysql> use mysql
Database changed
mysql> update user set password=PASSWORD("root") where user='root';
ERROR 1054 (42S22): Unknown column 'password' in 'field list'
mysql>
mysql>
mysql>
mysql>
mysql> select user from user;
+-----------+
| user |
+-----------+
| mysql.sys |
| root |
+-----------+
2 rows in set (0.00 sec)
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 authentication_string=PASSWORD("root") where user='root';
Query OK, 1 row affected, 1 warning (0.03 sec)
Rows matched: 1 Changed: 1 Warnings: 1
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> exit
Bye
[root@centos bin]# service mysqld restart
Shutting down MySQL.2016-05-16T18:16:32.859231Z mysqld_safe mysqld from pid file /soft/data/mysql.pid ended
[ OK ]
Starting MySQL.[ OK ]
[1]+ Done ./mysqld_safe --skip-grant-tables
[root@centos bin]#
[root@centos bin]#
[root@centos bin]#
[root@centos bin]# mysql -u root -p root
-bash: mysql: command not found
[root@centos bin]# ./mysql -u root -p root
Enter password:
ERROR 1049 (42000): Unknown database 'root'
[root@centos bin]# ./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.12
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> exit
Bye
[root@centos bin]#
[root@centos bin]#
[root@centos bin]#
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29108064/viewspace-2101719/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- mysql如何設定密碼MySql密碼
- Ubuntu MySQL5.7設定root密碼UbuntuMySql密碼
- MySql修改root密碼、設定IP訪問MySql密碼
- mysql5.7及以後版本設定密碼MySql密碼
- mysql 忘記密碼,mysql修改密碼MySql密碼
- Ubuntu安裝MySQL如何設定資料庫密碼UbuntuMySql資料庫密碼
- Linux下安裝MySQL後root密碼的設定LinuxMySql密碼
- MySQL5.7 使用者設定密碼解決方法MySql密碼
- JPA設定MySQL編碼MySql
- [Mysql]mysql忘記ROOT密碼MySql密碼
- MySQL——密碼管理MySql密碼
- MYSQL密碼管理MySql密碼
- MySQL密碼安全MySql密碼
- MySQL密碼忘了怎麼辦?MySQL重置root密碼方法MySql密碼
- MySQL字元編碼設定方法MySql字元
- Ubuntu 如何重設 MySQL 的 root 密碼UbuntuMySql密碼
- 線上直播原始碼,安裝mysql沒有提示設定密碼的問題原始碼MySql密碼
- mysql學習之-密碼管理(預設密碼,修改密碼,解決忘記密碼)MySql密碼
- MySQL 重置Root密碼MySql密碼
- mysql修改root密碼MySql密碼
- mysql重置root密碼MySql密碼
- 修改mysql root密碼MySql密碼
- Mysql密碼恢復MySql密碼
- mysql 忘記密碼MySql密碼
- MySQL忘記密碼MySql密碼
- mysql怎麼設定密碼都不正確的一個解決方法MySql密碼
- MYSQL修改密碼和忘記ROOT密碼MySql密碼
- MySQL prompt設定MySql
- MySQL 8.0 重置 root 密碼MySql密碼
- mysql8.0修改密碼MySql密碼
- linux mysql 找回密碼LinuxMySql密碼
- MySQL 8 下重置密碼MySql密碼
- 修改 MySQL 登入密碼MySql密碼
- MySQL入門--密碼策略MySql密碼
- Mac-mysql 密碼重置MacMySql密碼
- mysql修改管理員密碼MySql密碼
- MySQL密碼過期策略MySql密碼
- Mysql 5.5 重置root密碼MySql密碼