Add the MySQL service to the System Service of the server in Linux
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 @ www.bkjia.com ~] # Vim/usr/local/mysql5/share/mysql. server
46 basedir =/usr/local/mysql5
47 datadir =/home/mysql/data
3. Copy the Startup Program
[Root @ www.bkjia.com ~] # Cp-ar/usr/local/mysql5/share/mysql. server/etc/init. d/mysqld
4. Start the MySQL Service
[Root @ www.bkjia.com ~] # Netstat-nltp | grep mysql
[Root @ www.bkjia.com ~] # Service mysqld start
Starting MySQL. [OK]
[Root @ www.bkjia.com ~] # Netstat-nltp | grep mysql
Tcp00 0.0.0.0: 33060.0.0.0: * LISTEN5877/mysqld
5. Enter the MySQL database
[Root @ www.bkjia.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) 2000,201 3, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
Affiliates. Other names may be trademarks of their respective
Owners.
Type 'help; 'or' \ H' for help. type' \ C' to clear the current input statement.
Mysql>
6. Close and restart the MySQL Service
[Root @ www.bkjia.com ~] # Service mysqld stop
Shutting down MySQL. [OK]
[Root @ www.bkjia.com ~] # Netstat-nltp | grep mysql
[Root @ www.bkjia.com ~] # Service mysqld restart
MySQL manager or server PID file cocould not be found! [FAILED]
Starting MySQL... [OK]
[Root @ www.bkjia.com ~] # Service mysqld restart
Shutting down MySQL... [OK]
Starting MySQL. [OK]
[Root @ www.bkjia.com ~] #
Recommended reading:
Xshell Remote Management MySQL Server How to Select Automatic copy and right-click automatic paste settings!