MySQL startup commands

Source: Internet
Author: User

I. Startup Mode

1. Start with service: Service mysqld start

2. Use the mysqld script to start:/etc/init. d/MySQL start

3. Start with safe_mysqld: safe_mysqld &

Ii. Stop

1. Start with service: Service mysqld stop

2. Use the mysqld script to start:/etc/inint. d/mysqld stop

3. mysqladmin Shutdown

3. Restart

1. Start with service: Service mysqld restart

2. Use the mysqld script to start:/etc/inint. d/mysqld restart

I have encountered many problems. The most common is:
Error 2002: Can't connect to local MySQL Server throughsocket

'/Tmp/MySQL. Sock' (111)

Solution:
[Root @ test MySQL] #/usr/local/MySQL/bin/mysqladmin-u root/
>-S/var/lib/MySQL. Sock password 'your. passwd'
Or make a connection.
Ln-S/var/lib/MySQL. Sock/tmp
In fact, the error message "/tmp/MySQL. Sock" is not found in the/tmp directory.
The command is incorrect. I have encountered
Several Common Startup methods are not clearly remembered. If you are sure that mysql. Sock is available under TMP
File. Try other commands.
/Usr/local/MySQL/bin/MySQL-u root-P
/Usr/local/MySQL/bin/mysqld -- user = MySQL &
/Usr/local/MySQL/bin/mysqld -- user = root &
/Usr/local/MySQL/bin/mysqld_safe -- user = root &
/Usr/local/MySQL/bin/mysqld_safe -- user = MySQL &
/Usr/local/MySQL/bin/safe_mysqld -- uer = root &
Stopping server from PID File
/Usr/local/MySQL/data/localhost. localdomain. PID
060304 11:46:21 mysqld ended
This is a permission issue. My MySQL directory belongs to the root user and also belongs to the root group. You can use mysqld_safe to start MySQL,
You only need to pay attention to these MySQL, safe_mysqld, mysqld_safe, mysqld, and mysqladmin. Try multiple times.
Times
In fact, sometimes MySQL has started normally and check whether MySQL has started the command.
PS-Aux | grep mysqld
You will see the following similar content
MySQL 6394 0.0 1.5 10528 992 pts/3 S
/Usr/local/MySQL/
MySQL 6395 0.0 1.5 10528 992 pts/3 S
/Usr/local/MySQL/
MySQL 6396 0.0 1.5 10528 992 pts/3 S
/Usr/local/MySQL/
Root 6422 0.0 1.1 2408 732 pts/3 s grep
MySQL

Check whether MySQL is listening for port commands
Netstat-Tl | grep MySQL
You will see the following similar content
TCP 0 0 *: MySQL *: * listen

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.