LINUX restart MYSQL command details
- 2020-05-12 06:40:24
- OfStack
How do I start/stop/restart MySQL
1. Startup mode
1. Start with service: service mysqld start
2, start using mysqld script: / etc/inint d/mysqld start
3. Start with safe_mysqld: safe_mysqld&
2. Stop
1. Start with service: service mysqld stop
2, start using mysqld script: / etc/inint d/mysqld stop
3, mysqladmin shutdown
3. Restart
1. Start with service: service mysqld restart
2, start using mysqld script: / etc/inint d/mysqld restart
Ask questions
How do I start/stop/restart MySQL
1. Startup mode
1. Start with service: service mysqld start
2, start using mysqld script: / etc/inint d/mysqld start
3. Start with safe_mysqld: safe_mysqld&
2. Stop
1. Start with service: service mysqld stop
2, start using mysqld script: / etc/inint d/mysqld stop
3, mysqladmin shutdown
3. Restart
1. Start with service: service mysqld restart
2, start using mysqld script: / etc/inint d/mysqld restart
When I first learned mysql, I used redhat. What is start/rc. d/init. d/start
This is very simple, but later more and more learning, the system's own mysql, some version is too low, and some with
The web service you want to install requires a lower version of mysql
Later, I learned to install mysql in the way of tar. My mysql was installed in the /usr/local/mysql directory
We've had a lot of problems. The most common are:
ERROR 2002: Can't connect to local MySQL server through socket
'/tmp/mysql.sock' (111)
Solutions:
[root@test mysql]# /usr/local/mysql/bin/mysqladmin -u root /
>
-S /var/lib/mysql/mysql.sock password 'your.passwd'
Or make a connection
ln -s /var/lib/mysql/mysql.sock /tmp
You can't find /tmp/ mysql.sock is sometimes not /tmp without this file, it's boot
The orders are wrong. I've been there
There are several common ways of starting that you don't remember very well, if you're sure that tmp has mysql.sock
Try a few more 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 & (note safe_mysqld and mysqld_safe is different, & said mysql runs in the background) I will be an error
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 root users, and also belongs to root group. If I start mysqld_safe, I will have no problem.
Just pay attention to these: mysql,safe_mysqld,mysqld_safe,mysqld,mysqladmin
ps -aux | grep mysqld
You'll see something like this
mysql 6394 0.0 1.5 10528 992 pts/3 S 16:16 0:00
/usr/local/mysql/
mysql 6395 0.0 1.5 10528 992 pts/3 S 16:16 0:00
/usr/local/mysql/
mysql 6396 0.0 1.5 10528 992 pts/3 S 16:16 0:00
/usr/local/mysql/
root 6422 0.0 1.1 2408 732 pts/3 S 16:20 0:00 grep
mysql
See if mysql is listening to port commands
netstat -tl | grep mysql
You'll see something like this
tcp 0 0 *:mysql *:* LISTEN