Home >Database >Mysql Tutorial >How to enter the mysql command line in linux?

How to enter the mysql command line in linux?

青灯夜游
青灯夜游Original
2019-05-20 19:02:1419027browse

How to enter the mysql command line in linux?

How to enter the mysql command line in Linux?

Format:

mysql -h主机地址 -u用户名-p用户密码

can be divided into two situations:

1. Connect to For MYSQL

on this machine, you can generally directly type the command

mysql -uroot -p

and press Enter. You will be prompted to enter your password. If MYSQL has just been installed, the super user root does not have a password, so just press Enter. You can enter MYSQL. The prompt of MYSQL is: mysql>

2. Connect to MySQL on the remote host

Assume that the IP of the remote host is: 10.0 .0.1, the username 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, and the same applies to others)

How to exit the MySQL command?

exit (回车)

The above is the detailed content of How to enter the mysql command line 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