Add the MySQL service to the System Service of the server in Linux

Source: Internet
Author: User
In Linux, add the MySQL service to the System Service of the server. 1. Understand the MySQL program path. MySQL data directory: homemysqldataMySQL program Directory: usrlo

In Linux, add the MySQL service to the System Service of the server. 1. Find out the MySQL program path. MySQL data directory:/home/mysql/dataMySQL program Directory:/usr/lo

Homepage → Database Technology

Background:

Read News

Add the MySQL service to the System Service of the server in Linux

[Date: 2013-07-27] Source: Linux community Author: lyq314 [Font:]

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 @ ~] # Vim/usr/local/mysql5/share/mysql. server
46 basedir =/usr/local/mysql5
47 datadir =/home/mysql/data

3. Copy the Startup Program

[Root @ ~] # Cp-ar/usr/local/mysql5/share/mysql. server/etc/init. d/mysqld

4. Start the MySQL Service

[Root @ ~] # Netstat-nltp | grep mysql
[Root @ ~] # Service mysqld start
Starting MySQL. [OK]
[Root @ ~] # Netstat-nltp | grep mysql
Tcp00 0.0.0.0: 33060.0.0.0: * LISTEN5877/mysqld

5. Enter the MySQL database

[Root @ ~] #/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 @ ~] # Service mysqld stop
Shutting down MySQL. [OK]
[Root @ ~] # Netstat-nltp | grep mysql
[Root @ ~] # Service mysqld restart
MySQL manager or server PID file cocould not be found! [FAILED]
Starting MySQL... [OK]
[Root @ ~] # Service mysqld restart
Shutting down MySQL... [OK]
Starting MySQL. [OK]
[Root @ ~] #

Recommended reading:

Xshell Remote Management MySQL Server How to Select Automatic copy and right-click automatic paste settings!

  • 0
  • Source code compilation and installation of MySQL 5.5.30

    MySQL Single-host multi-instance solution deployment

    Related information: linux mysql MySQL Service

    Image Information

  • MySQL cannot be solved in Linux
  • View All comments in this article (0)

    Comments

    Latest Information

    Popular this week

    Introduction to Linux community-advertisement service-website map-help Info-contact us
    The articles published on this site (LinuxIDC) do not mean that they agree with the statement or description. They only provide more information and do not constitute any suggestions.


    Copyright©2006-2011 Linux community All rights reserved Zhejiang ICP backup No. 06018118

    ,

    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.