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 problem of not prompting for password when installing MySQL in Ubuntu 18.04 and its solution

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

Share

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

Ubuntu 1804 installation MySQL 5.7 as an example to give you a very detailed introduction.

Execute the command to install MySQL

Sudo apt install mysql-serversudo apt install mysql-client

After installation, check to see if it starts:

Sudo ps aux | grep mysql

If it is already started, you can see the corresponding information after executing the above command. If it is not started, execute the following command to start mysql:

Sudo service mysql start

In addition, the restart mysql command will be used later. The commands for restarting and shutting down mysql are:

Sudo service mysql restartsudo service mysql stop

After ensuring that mysql starts successfully, you can log in to mysql, but you are not prompted for a user name and password during installation, so you can view a default user name and password in'/ etc/mysql/debian.cnf':

Sudo cat / etc/mysql/debian.cnf

Log in to mysql with user and password:

Mysql-udebian-sys-maint-pZBms1EM5icCfeePV

But the default username and password thieves are hard to remember, so you can add a user named my_name with a password of my_password through the following sql statement:

Show databases;use mysql;update user set authentication_string=PASSWORD ("my_password") where user='my_name';update user set plugin= "mysql_native_password"; flush privileges;exit

After adding users, restart mysql and log in with my_name at this time.

Summary

The above is the problem and solution that the editor introduced to you when Ubuntu 18.04installs MySQL without prompting to enter the password. 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!

If you think this article is helpful to you, you are welcome to reprint it, please indicate the source, thank 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.

Share To

Servers

Wechat

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

12
Report