1, understand the MySQL program path
MySQL Data directory:/home/mysql/data
MySQL Program directory:/USR/LOCAL/MYSQL5
2, modify the MySQL service startup program
[root@lyq314 ~]# Vim/usr/local/mysql5/share/mysql/mysql.server
Basedir=/usr/local/mysql5
Datadir=/home/mysql/data
3. Copy Start Program
[root@lyq314 ~]# Cp-ar/usr/local/mysql5/share/mysql/mysql.server/etc/init.d/mysqld
4. Start MySQL Service
[root@lyq314 ~]# netstat-nltp |grep MySQL
[root@lyq314 ~]# Service mysqld start
Starting MySQL. [OK]
[root@lyq314 ~]# netstat-nltp |grep MySQL
Tcp00 0.0.0.0:33060.0.0.0:*listen5877/mysqld
5, into the MySQL database
[root@lyq314 ~]#/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), 2013, Oracle and/or its affiliates. All rights reserved.
This column more highlights: http://www.bianceng.cn/database/MySQL/
Oracle is a registered trademark the Oracle Corporation and/or its
Affiliates. Names may trademarks of their respective
Owners.
Type ' help, ' or ' \h ' for help. Type ' \c ' to clear the current input statement.
Mysql>
6, the MySQL service shutdown and restart
[root@lyq314 ~]# service mysqld Stop
Shutting down MySQL. [OK]
[root@lyq314 ~]# netstat-nltp |grep MySQL
[root@lyq314 ~]# Service mysqld Restart
MySQL Manager or server PID file could not is found! [FAILED]
Starting MySQL. [OK]
[root@lyq314 ~]# Service mysqld Restart
Shutting down MySQL ..... [OK]
Starting MySQL. [OK]
[Root@lyq314 ~]#