In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article introduces the knowledge of "how to set the root password in mysql". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
[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 ('Nickel Magazine Y') | NO | | N | |
| | Insert_priv | enum ('Nickel Magazine Y') | NO | | N | |
| | Update_priv | enum ('Nickel Magazine Y') | NO | | N | |
| | Delete_priv | enum ('Nickel Magazine Y') | NO | | N | |
| | Create_priv | enum ('Nickel Magazine Y') | NO | | N | |
| | Drop_priv | enum ('Nickel Magazine Y') | NO | | N | |
| | Reload_priv | enum ('Nickel Magazine Y') | NO | | N | |
| | Shutdown_priv | enum ('Nickel Magazine Y') | NO | | N | |
| | Process_priv | enum ('Nickel Magazine Y') | NO | | N | |
| | File_priv | enum ('Nickel Magazine Y') | NO | | N | |
| | Grant_priv | enum ('Nickel Magazine Y') | NO | | N | |
| | References_priv | enum ('Nickel Magazine Y') | NO | | N | |
| | Index_priv | enum ('Nickel Magazine Y') | NO | | N | |
| | Alter_priv | enum ('Nickel Magazine Y') | NO | | N | |
| | Show_db_priv | enum ('Nickel Magazine Y') | NO | | N | |
| | Super_priv | enum ('Nickel Magazine Y') | NO | | N | |
| | Create_tmp_table_priv | enum ('Nickel Magazine Y') | NO | | N | |
| | Lock_tables_priv | enum ('Nickel Magazine Y') | NO | | N | |
| | Execute_priv | enum ('Nickel Magazine Y') | NO | | N | |
| | Repl_slave_priv | enum ('Nickel Magazine Y') | NO | | N | |
| | Repl_client_priv | enum ('Nickel Magazine Y') | NO | | N | |
| | Create_view_priv | enum ('Nickel Magazine Y') | NO | | N | |
| | Show_view_priv | enum ('Nickel Magazine Y') | NO | | N | |
| | Create_routine_priv | enum ('Nickel Magazine Y') | NO | | N | |
| | Alter_routine_priv | enum ('Nickel Magazine Y') | NO | | N | |
| | Create_user_priv | enum ('Nickel Magazine Y') | NO | | N | |
| | Event_priv | enum ('Nickel Magazine Y') | NO | | N | |
| | Trigger_priv | enum ('Nickel Magazine Y') | NO | | N | |
| | Create_tablespace_priv | enum ('Nickel Magazine 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 ('Nickel Magazine Y') | NO | | N | |
| | password_last_changed | timestamp | YES | | NULL |
| | password_lifetime | smallint (5) unsigned | YES | | NULL |
| | account_locked | enum ('Nickel Magazine 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] #
This is the end of the content of "how to set the root password for mysql". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.