Home > Database > Mysql Tutorial > body text

What is the default mysql password in linux

WBOY
Release: 2022-04-07 17:08:18
Original
10358 people have browsed it

In Linux, mysql has no password by default after installation. After logging in to mysql, you can use the "UPDATE user SET password=password("new password") WHERE user='root'" command to set a new password.

What is the default mysql password in linux

The operating environment of this tutorial: linux7.3 system, mysql8.0.22 version, Dell G3 computer.

What is the default mysql password in Linux

There is no password by default after installation.

After Linux downloads mysql, the default password for the root user is empty, that is, if you are prompted to enter the password, just press the Enter key.

Start the mysql server, log in to mysql, enter

mysql -u root
Copy after login

when prompted to enter the password and press Enter

Modify the password:

mysql> use mysql;
mysql> UPDATE user SET password=password("test123") WHERE user='root';
Copy after login

Refresh the permission table, enter as follows Command: flush privileges

mysql> flush privileges
Copy after login

Exit: quit

mysql> quit
Copy after login

Log in again and enter the password you just changed.

There is no password by default, but you can only log in locally, not remotely. For example, if you are installed as root: Enter: mysql -uroot at the local command line to log in directly, and then change the username and password.

Enter mysql -u root -p without a password. Press Enter and continue to enter without entering the password. If you cannot enter, check whether the mysqld service is started. If not, enter service mysqld start to start.

Recommended learning: mysql video tutorial

The above is the detailed content of What is the default mysql password in linux. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!