The MySQL service is added to the server's system service under Linux

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.