Home  >  Article  >  php教程  >  How to enter the MySQL command line under Linux

How to enter the MySQL command line under Linux

高洛峰
高洛峰Original
2016-12-14 11:03:081150browse

Connect to MySQL:

Format: mysql -h host address -u username -p user password

1. Example 1: Connect to MYSQL on this machine

Find the installation directory of mysql. Generally, you can directly type the command mysql - uroot -p, press Enter to prompt you to enter the password. If MYSQL has just been installed, the super user root does not have a password, so you can enter MYSQL directly by pressing Enter. The MYSQL prompt is: mysql>

2. Connect to MySQL on the remote host

Assume that the IP of the remote host is: 10.0.0.1, the user name is root, and the password is 123. Then type the following command:

mysql -h10.0.0.1 -uroot -p123

(Note: u and root do not need to add spaces, the same goes for others)

3. Exit the MySQL command

exit (Enter)


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