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

How to change the MySQL password by Linux

2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

Linux how to change the MySQL password, in view of this question, this article introduces the corresponding analysis and answer in detail, hoping to help more partners who want to solve this problem to find a more simple and easy way.

When we installed MySQL in the Linux system, we enthusiastically typed in the terminal: mysql-u root-p, prompting access denied. Ues password YES/NO error, the reason for this error is the wrong password, so how to change the MySQL password?

Step 1: at this point, you need to enter the / etc/mysql directory, then sudo vim/vi debian.cnf to check the user name and password inside, and then use the user name and password in this file to enter mysql. If the user name in debian.cnf is debian-sys-maint, then:

Mysql-u debian-sys-maint-p press enter, which requires you to enter your password and copy the password in debian.cnf (do not enter it manually, because it is prone to errors).

At this point, you can enter mysql.

Step 2: modify the human root password

Log in to the mysql client according to the previous step

Mysql > use mysql; Database changed mysql > update user set password=password ('new password') where user='root'; Query OK, 4 rows affected (0.00 sec) Rows matched: 4 Changed: 4 Warnings: 0 mysql > flush privileges; Query OK, 0 rows affected (0 sec) mysql > quit step 3: log in with the newly changed root and password.

Install phpmyadmin1, open the terminal, type sudo apt-get install phpmyadmin, and enter enter

2. After the installation is complete, go to the apache server directory (changed from / var/www/html to / media/home/ivalley) and find that there is no phpmyadmin, such files or folders

3. Here is the point. When the system installs the software, it installs the software under / usr/share/ by default, so your phpmyadmin can be found under / usr/share.

4. Therefore, we must establish a soft connection so that the file shown in step 3 is linked to a document under / media/home/ivalley, enter the following code sudo ln-s / usr/share/phpmyadmin / media/home/ivalley/phpmyadmin

5. Next, open the browser, enter http://localhost/phpmyadmin, enter your account name and password, and you can log in smoothly and use the MySQL database happily.

This is the answer to the question about how to change the MySQL password in Linux. I hope the above content can be of some help to you. If you still have a lot of doubts to solve, you can follow the industry information channel for more related knowledge.

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

Development

Wechat

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

12
Report