Home  >  Article  >  Database  >  How to log in to MySQL on Linux system

How to log in to MySQL on Linux system

PHPz
PHPzforward
2023-05-28 12:48:3716983browse

The main steps to log in to Mysql on Linux are:

\1. Log in to local mysql:

 mysql -u 用户名 -p # 例如 mysql -u root -p  #先输入,回车 
 # 也可不用空格 mysql -u用户名 -p

Then prompt to enter the password and press Enter;

\2. Log in Remote mysql: There is a host name and port number, sometimes there is no port number

 mysql -h 主机 -P 端口 -u 用户名 -p 
 #也可不用空格 mysql -h主机 -P端口 -u用户名 -p

Then you are prompted to enter the password and press Enter.

The above is the detailed content of How to log in to MySQL on Linux system. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:yisu.com. If there is any infringement, please contact admin@php.cn delete