標籤:http io ar sp for strong 資料 on div
Linux下將MySQL服務添加到伺服器的系統服務中
Linux環境下將MySQL服務添加到伺服器的系統服務中
1、瞭解MySQL程式路徑
MySQL資料目錄: /home/mysql/data
MySQL程式目錄:/usr/local/mysql5
2、修改MySQL服務啟動程式
[[email protected] www.linuxidc.com ~]# vim /usr/local/mysql5/share/mysql/mysql.server
46 basedir=/usr/local/mysql5
47 datadir=/home/mysql/data
3、拷貝啟動程式
[[email protected] www.linuxidc.com ~]# cp -ar /usr/local/mysql5/share/mysql/mysql.server /etc/init.d/mysqld
4、啟動MySQL服務
[[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、進入MySQL資料庫
[[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) 2000, 2013, 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、MySQL服務的關閉與重新啟動
[[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 be 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 ~]#
推薦閱讀:
Xshell遠端管理MySQL伺服器如何?選擇自動複製以及右鍵自動粘貼的設定! http://www.linuxidc.com/Linux/2013-06/85933.htm
Linux下將MySQL服務添加到伺服器的系統服務中