- 单实例下直接停掉数据库
- 多实例情况下杀掉相应实例的进程,比如3306
[root@Ly-vm-02-db ~]# ps aux |grep mysql
root 10384 0.0 0.0 106244 1416 ? S 18:48 0:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --defaults-file=my.cnf
mysql 11370 0.0 29.8 1061116 567060 ? Sl 18:48 0:09 /usr/local/mysql/bin/mysqld --defaults-file=my.cnf --basedir=/usr/local/mysql --datadir=/data/mysql/3307/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/data/mysql/3307/mysqld_3307.err --open-files-limit=1024 --pid-file=/data/mysql/3307/mysqld.pid --socket=/data/mysql/3307/mysql.sock --port=3307
root 12618 0.0 0.0 106248 1472 ? S 19:27 0:00 /bin/sh /usr/local/mysql/bin//mysqld_safe --defaults-file=/data/mysql/3306/my.cnf
mysql 14472 0.0 6.5 637228 125068 ? Sl 21:58 0:03 /usr/local/mysql/bin/mysqld --defaults-file=/data/mysql/3306/my.cnf --basedir=/usr/local/mysql --datadir=/data/mysql/3306/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/data/mysql/3306/mysqld_3306.err --open-files-limit=48 --pid-file=/data/mysql/3306/mysqld.pid --socket=/data/mysql/3306/mysql.sock --port=3306
root 15038 0.0 0.0 103316 832 pts/1 S+ 23:50 0:00 grep mysql
[root@Ly-vm-02-db ~]# kill 14472
- 使用命令重新启动
[root@Ly-vm-02-db ~]# /usr/local/mysql/bin/mysqld_safe --defaults-file=/data/mysql/3306/my.cnf --skip-grant-table &
[root@Ly-vm-02-db ~]# mysql -S /data/mysql/3306/mysql.sock
mysql> UPDATE user SET password=PASSWORD(‘zckj.com‘) WHERE user=‘root‘;
Query OK, 0 rows affected (0.00 sec)
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
注意:多实例下--skip-grant-table参数一定下my.cnf参数后边启动
- 正常退出后,重新正常启动即可,否则还是带着--skip-grant-table 参数