Home  >  Article  >  Database  >  Log in to MySQL using MySQL database (1)

Log in to MySQL using MySQL database (1)

黄舟
黄舟Original
2016-12-27 17:16:231337browse

When the MySQL service is running, we can log in to the MySQL database through the client tool that comes with MySQL. First open the command prompt and enter the name in the following format:

mysql -h host name- u Username-p

-h: This command is used to specify the MySQL host name to be logged in by the client. This parameter can be omitted when logging in to the current machine;

-u: The user name to be logged in ;

-p: Tell the server that a password will be used to log in. If the username and password to be logged in are empty, you can ignore this option.

Take logging in to the MySQL database just installed on this machine as an example. Enter mysql -u root -p at the command line and press Enter to confirm. If the installation is correct and MySQL is running, you will get the following response:

Enter password:

If the password exists, enter the password to log in. If it does not exist, just press Enter to log in. According to the installation method in this article, the default root account has no password. After successfully logging in, you will see the Welcome to the MySQL monitor... prompt.

Then the command prompt will always be mysql> with a blinking cursor waiting for command input. Enter exit or quit to log out.

The above is the content of logging in to MySQL using MySQL database (1). For more related content, please pay attention to the PHP Chinese website (www.php.cn)!


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