Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The method of retrieving mysql password of Alibaba Cloud Server

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

First of all, if you have just installed mysql, the password is the random password given by him. You can use the path / var/log/mysqld.log.

Cd to the specified directory

Cd / var/log

And then

Vi mysqld.log

View the

[Note] A temporary password is generated for root@localhost:

The following part is the random password given to you for the first time.

Generally speaking, it is in the top section because it is given to you for the first time after installation, of course, it can also be searched.

After knowing the password, you can log in to the mysql database normally.

Mysql-u root-p

Enter the password you just found here

Of course, if it's not the first time you've forgotten your random password, there are other ways, as follows:

Try to modify the configuration file of mysql, bypass the password detection of mysql, and change the password after a successful login.

Configuration file

/ etc/my.cnf

So

Cd / etc

And then

Vi my.cnf

Locate the [mysqld] segment and pause the cursor anywhere in the segment

Press o (enter insert mode and start typing on a new line)

Use the keyboard to enter

Skip-grant-tables

Press the colon of the keyboard ":" (return to bottom line mode) and type wq (for save and exit) to press enter.

Terminal input:

Service mysqld restart

Restart it

Then you can log in to mysql without a password.

Mysql-u root-p

Enter directly

Enter the mysql, you can change the password.

Use mysqlupdate mysql.user set authentication_string=password ('set by yourself') where user='root'

And then save.

Flush privileges;exit

Change the password OK now.

But just to skip password authentication, so modified my.cnf

So now we have to revise it back.

Go back to / etc again

Cd / etc

Modify my.cnf

Vi my.cnf

Delete the one you just joined

And then

: wq

You can log in with a password.

Summary

The above is the method to retrieve the mysql password of Ali Yunyun server introduced by Xiaobian to you. I hope it will be helpful to you. If you have any questions, please leave me a message and the editor will reply to you in time. Thank you very much for your support to the website!

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.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report