Home >Database >Mysql Tutorial >What is the default mysql password in linux

What is the default mysql password in linux

WBOY
WBOYOriginal
2022-04-07 17:08:1810426browse

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

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';

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

mysql> flush privileges

Exit: quit

mysql> quit

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!

Statement:
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