In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces "how to change the root password in Linux mysql". In the daily operation, I believe many people have doubts about how to change the root password in Linux mysql. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the doubts about "how to change the root password in Linux mysql". Next, please follow the editor to study!
When it comes to root passwords, many people think of the root account password of the computer system. In fact, mysql also has a root password, so in the Linux system, how can mysql change the root password? Especially what should I do if I forget my root password?
Modify the password of the user (root) of Mysql under Linux
All modified users have root as the column.
First, the password of the root with the original myql
Method 1:
Outside of the mysql system, use mysqladmin
# mysqladmin-u root-p password "test123"
Enter password: [enter the original password]
Method 2:
By logging in to the mysql system
# mysql-uroot-p
Enter password: [enter the original password]
Mysql > use mysql
Mysql > update user set password=passworD ("test") where user='root'
Mysql > flush privileges
Mysql > exit
Forget the password of the original myql root
First of all, you must have root permission for the operating system. If you don't even have root permission for the system, consider the root system before taking the following steps.
Similar to the safe mode login system, some people suggest that it is pkill mysql, but I do not recommend it. Because when you execute this command, it will lead to a situation like this:
/ etc/init.d/mysqld status
Mysqld dead but subsys locked
So even if you start mysql in safe mode, it may not be useful, so it's usually like this / etc/init.d/mysqld stop, if you unfortunately use pkill first, then start and then stop.
# mysqld_safe-- skip-grant-tables &
It means that if you run in the background and no longer run in the background, you will open another terminal.
# mysql
Mysql > use mysql
Mysql > UPDATE user SET password=password ("test123") WHERE user='root'
Mysql > flush privileges
Mysql > exit
# # originally mysql is case-independent, but this is the specific value of the mysql database in the modified mysql, which should be noted.
By logging in to the mysql system:
The code is as follows
# mysql-uroot-p
Enter password: [enter the original password]
Mysql "use mysql
Mysql "update user set password=passworD (" test ") where user='root'
Mysql "flush privileges
Mysql "exit
Outside of the mysql system, use mysqladmin:
The code is as follows
# mysqladmin-u root-p password "test123"
Enter password: [enter the original password]
Forget the password of the original myql's root:
First of all, you must have root permission for the operating system. If you don't even have root permission for the system, consider the root system before taking the following steps.
Similar to the safe mode login system, some people suggest that it is pkill mysql, but I do not recommend it. Because when you execute this command, it will lead to a situation like this:
The code is as follows
/ etc/init.d/mysqld status
Mysqld dead but subsys locked
So even if you start mysql in safe mode, it may not be useful, so it's usually like this / etc/init.d/mysqld stop, if you unfortunately use pkill first, then start and then stop.
The code is as follows
# mysqld_safe-skip-grant-tables &
It means that if you run in the background and no longer run in the background, you will open another terminal.
The code is as follows
# mysql
Mysql "use mysql
Mysql "UPDATE user SET password=password (" test123 ") WHERE user='root'
Mysql "flush privileges
Mysql "exit
# # originally mysql is case-independent, but this is the specific value of the mysql database in the modified mysql, which should be noted.
At this point, the study on "how to change the root password by Linux mysql" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
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.