The younger brother today records the simple use of MySQL below the Linux system, as follows:
- service startup and shutdown
- start and close
- View version
Environment
Linux version: Centeros 6.6 (demo below), Ubuntu 12.04 (see the article at the end of the Red label font)
MySQL version: 5.1.73
To view the startup status of the MySQL service,
Enter the command: /etc/init.d/mysqld Status
or: service mysqld Status
Example diagram:
Or
Then start the MySQL service,
Enter the command: Service mysqld Start
or: /etc/init.d/mysqld start
Example diagram:
Or
The discovery failed to start, this is due to not using administrator state to start, the following switch to the administrator state to try again,
Example diagram:
Then log in,
Input command:mysql–uroot–p123456(123456 for password)
Or: mysql–uroot-p(enter, then password)
Example diagram:
View MySQL version,
Enter the command: select version ();
Example diagram:
Quit (Close) MySQL,
Enter the command: Exit
Example diagram:
Close the service,
Enter the command: service mysqld Stop
or: /etc/init.d/mysqld stop
Example diagram:
Or
Note: The above is done under the Center OS system, the younger brother in the Ubuntu system is also tested, unlike the center OS, Ubuntu need to use the Center OS inside the command of the mysqld behind the D removed, All of the commands shown above can be replaced with MySQL directly using mysqld.
Reprint Please specify source: http://blog.csdn.net/yannanying/article/details/43087143
Play MySQL Linux simple operation (service start and close, start and close, view version)