Simple operations in MySQL Linux (Service Startup and shutdown, startup and shutdown, view Version)
Today, the younger brother recorded the simple use of MySQL in the Linux system, as follows:
Start and Stop a service. view the version
Environment
Linux: centeros 6.6 (as shown below) and Ubuntu 12.04 (see red font at the end of the article)
MySQL version: 5.1.73
View the MySQL service startup status,
Enter the command:/etc/init. d/mysqld status
Or: service mysqld status
Example:
Or
Start the MySQL service,
Enter the command: service mysqld start
Or:/etc/init. d/mysqld start
Example:
Or
Failed to start because the Administrator status is not used for startup. Next, switch to the Administrator status and try again,
Example:
Then log on,
Run mysql-uroot-p123456 (123456 is the password)
Or: mysql-uroot-p (Press enter and enter the password)
Example:
View MySQL version,
Enter the command: select version ();
Example:
Exit (close) MySQL,
Enter the command: exit
Example:
Close the service,
Enter the command: service mysqld stop
Or:/etc/init. d/mysqld stop
Example:
Or
Note: The above operations are carried out in the center OS system, and the younger brother has also conducted tests in the Ubuntu system. Unlike the center OS system, in Ubuntu, remove the d following mysqld in the Command Used in the center OS. All the commands shown above can replace mysqld directly with mysql.