Home > php教程 > PHP开发 > body text

How to enter the MySQL command line under Linux

高洛峰
Release: 2016-12-14 11:03:08
Original
1102 people have browsed it

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)


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 Recommendations
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!