The MySQL service is added to the server's system service under Linux
The MySQL service is added to the server's system service under the Linux environment
1. Understanding MySQL Program Path
MySQL Data Catalog:/home/mysql/data
MySQL Program directory:/USR/LOCAL/MYSQL5
2. Modify the MySQL service startup program
[Email protected] www.linuxidc.com ~]# vim/usr/local/mysql5/share/mysql/mysql.server
Basedir=/usr/local/mysql5
Datadir=/home/mysql/data
3. Copy Startup program
[Email protected] www.linuxidc.com ~]# cp-ar/usr/local/mysql5/share/mysql/mysql.server/etc/init.d/mysqld
4. Start the MySQL service
[Email protected] www.linuxidc.com ~]# netstat-nltp |grep MySQL
[[email protected] www.linuxidc.com ~]# service mysqld start
Starting MySQL. [OK]
[Email protected] www.linuxidc.com ~]# netstat-nltp |grep MySQL
Tcp00 0.0.0.0:33060.0.0.0:*listen5877/mysqld
5. Enter MySQL Database
[Email protected] www.linuxidc.com ~]#/usr/local/mysql5/bin/mysql-uroot-p-s/tmp/mysql.sock
Enter Password:
Welcome to the MySQL monitor.commands end with; or \g.
Your MySQL Connection ID is 1
Server Version:5.1.68-log Source Distribution
Copyright (c) and/or, Oracle, its affiliates. All rights reserved.
Oracle is a registered trademark of the Oracle Corporation and/or its
Affiliates. Other names trademarks of their respective
Owners.
Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the current input statement.
Mysql>
6. Shutdown and restart of MySQL service
[[email protected] www.linuxidc.com ~]# service mysqld Stop
Shutting down MySQL. [OK]
[Email protected] www.linuxidc.com ~]# netstat-nltp |grep MySQL
[Email protected] www.linuxidc.com ~]# service mysqld Restart
MySQL Manager or server PID file could not being found! [FAILED]
Starting MySQL. [OK]
[Email protected] www.linuxidc.com ~]# service mysqld Restart
Shutting down MySQL ..... [OK]
Starting MySQL. [OK]
[Email protected] www.linuxidc.com ~]#
Recommended reading:
Xshell remote Management MySQL server How to choose automatic Copy and right-click Auto-paste settings! Http://www.linuxidc.com/Linux/2013-06/85933.htm
The MySQL service is added to the server's system service under Linux