一 root:
使用service
[root@centospg0326 ~]# service mysqld start
[root@centospg0326 ~]# service mysqld stop
Shutting down MySQL.. SUCCESS!
[root@centospg0326 ~]# ps -ef |grep mysql
root 10367 10090 0 17:52 pts/1 00:00:00 su - mysql
mysql 10368 10367 0 17:52 pts/1 00:00:00 -bash
root 10647 1 0 18:03 pts/2 00:00:00 /bin/sh /usr/local/mysql-5.7.31/bin/mysqld_safe --datadir=/usr/local/mysql-5.7.31/data --pid-file=/usr/local/mysql-5.7.31/data/centospg0326.pid
mysql 10788 10647 3 18:03 pts/2 00:00:00 /usr/local/mysql-5.7.31/bin/mysqld --basedir=/usr/local/mysql-5.7.31 --datadir=/usr/local/mysql-5.7.31/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=centospg0326.err --pid-file=/usr/local/mysql-5.7.31/data/centospg0326.pid --port=3306
root 10818 10475 0 18:03 pts/2 00:00:00 grep --color=auto mysql
二
启动:/usr/local/mysql-5.7.31/bin/mysqld_safe --defaults-file=/etc/my.cnf
关闭:
[root@centospg0326 ~]# find / -name 'mysql.sock' -print
/tmp/mysql.sock
[root@centospg0326 ~]# /usr/local/mysql-5.7.31/bin/mysqladmin -u root -S /tmp/mysql.sock shutdown
三 ,如下 ./mysqld --defaults-file=/etc/my.cnf --user=root,待验证
[root@centospg0326 bin]# ./mysqld --defaults-file=/etc/my.cnf --user=root
2022-11-05T10:53:07.169446Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2022-11-05T10:53:07.169815Z 0 [Note] --secure-file-priv is set to NULL. Operations related to importing and exporting data are disabled
2022-11-05T10:53:07.169841Z 0 [Note] ./mysqld (mysqld 5.7.31) starting as process 13536 ...
2022-11-05T10:53:07.169871Z 0 [ERROR] Can't find error-message file '/usr/local/mysql-5.7.31/share/errmsg.sys'. Check error-message file location and 'lc-messages-dir' configuration directive.