In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly gives you a brief description of the specific steps of resetting the MySQL Root password in Ubuntu. You can check the relevant professional terms on the Internet or find some related books to supplement them. We will not dabble here, so let's go straight to the topic. I hope this article on the specific steps of resetting the MySQL Root password in Ubuntu can bring you some practical help.
How to reset the MySQL Root password on Ubuntu
Last updated on February 13, 2019
In this article, we will reset the MySQL root password in Ubuntu by starting MySQL with this-- skip-grant-tables option.
1. Confirm the MySQL version (http://www.1nt6.com)
First, you must confirm which version of MySQL on the Ubuntu you are running, because the commands will be different.
Mysql-Vmysql Ver 14.14 Distrib 5.7.25, for Linux (x86 / 64) using EditLine wrapper
Write down your "Distrib". In the above example, we are using MySQL 5.7. Please pay attention to this later.
two。 Restart MySQL using skip-grant-table ()
Http://www.1nt6.com
In order to skip the authorization table and reset the root password, we must first stop the MySQL service.
Sudo / etc/init.d/mysql stop
Make sure the directory / var/run/mysqld exists and correct the owner settings.
Sudo mkdir / var/run/mysqldsudo chown mysql / var/run/mysqld
Now start MySQL with the-- skip-grant-tables option. This is necessary.
Sudo mysqld_safe-skip-grant-tables&
You should see something like this:
[1] 1283 username server 12T11:15:59.922502Z mysqld_safe Starting mysqld daemon with databases from $2019-02-12T11:15:59.872516Z mysqld_safe Logging to syslog.2019-02-12T11:15:59.879527Z mysqld_safe Logging to'/ var/log/mysql/error.log'.2019-02-12T11:15:59.922502Z mysqld_safe Starting mysqld daemon with databases from / var/lib/mysql
You may need to press ENTER to return to the Linux BASH prompt.
3. Change the MySQL Root password
You can now log in to your MySQL root account without a password.
Sudo mysql-user=root mysql
After logging in, you will see the mysql > prompt.
For MySQL version 5.7 or later on Ubuntu, run this command to change the root password. Replace your_password_here with your own.
Mysql > update user set authentication_string=PASSWORD ('your_password_here') where user='root'
For MySQL 5.6 or earlier on Ubuntu, run this command to change the root password. Replace your_password_here with your own.
Mysql > update user set Password=PASSWORD ('your_password_here') where user='root'
When you reset the root password, you must also change the auth plug-in to mysql_native_password
Mysql > update user set plugin= "mysql_native_password" where User='root'
Refresh privileges.
Mysql > flush privileges
Exit MySQL.
Mysql > exit
Be sure to stop all MySQL processes before starting the service again.
Sudo killall-u mysql
Start MySQL again.
Sudo / etc/init.d/mysql start4. Test the new password
Log in to MySQL again and you should now be prompted for your password http://www.1nt6.com.
Sudo mysql-p-u root
Enter your password. If it's right, you should see
Welcome to the MySQL monitor. Commands end with; or\ g.Your MySQL connection id is 6Server version: 5.7.25-0ubuntu0.18.04.2 (Ubuntu)
The specific steps of resetting the MySQL Root password in Ubuntu will stop here. If you want to know about other related issues, you can continue to follow our industry information. Our section will capture some industry news and professional knowledge to share with you every day.
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.