Command line khởi động MySQ L trên Red Hat Linux

Command line khởi động MySQ L trên Red Hat Linux

Introduction

After you've installed MySQL it's often a good and convenient idea to make it start and stop automatically with the machine. These instructions are specific for Red Hat Linux and it's variants since different Linux distributions tend to layout the start up scripts differently.

The example script is based on my MySQL installation instructions.

Making MySQL Start and Stop Automatically

  1. You need to be root to do these steps:
        su root
    
  2. Now go to the MySQL directory:
        cd /usr/local/mysql
    
  3. First we have to put the start up script with all the others.
        cp support-files/mysql.server /etc/rc.d/init.d/mysql
    
  4. To make the script be run on machine start up we need to create a symbolic link to it.
        cd /etc/rc.d/rc3.d
        ln -s ../init.d/mysql S85mysql
        cd /etc/rc.d/rc5.d
        ln -s ../init.d/mysql S85mysql
    
  5. Now the links to make MySQL shut down:
        cd /etc/rc.d/rc0.d
        ln -s ../init.d/mysql K85mysql
        cd /etc/rc.d/rc6.d
        ln -s ../init.d/mysql K85mysql
    
  6. The mysql script must have execute permissions before it will work.
        cd ../init.d
        chmod +x mysql
    
  7. You may need to change the user that mysql should be run as. Look for the mysqld_user variable about half way through the script and change it to be the appropriate user. If you used our MySQL install instructions the user should be mysql.
  8. You can now reboot your machine to test this setup.
        shutdown -r now
    
  9. When the machine starts, check that the mysql daemon actually started:
        cd /usr/local/mysql
        bin/mysqladmin -uroot -p[admin password  eg. mypass] ping
    

    Hopefully you get this response:

        mysqld is alive
    

    If you get a message like this then something went wrong:

        mysqladmin: connect to server at 'localhost' failed
        error: 'Can't connect to local MySQL server (2)'
        Check that mysqld is running and that the socket '/tmp/mysql.sock' exists!
    
Bạn thấy bài viết này như thế nào?: 
Average: 5 (2 votes)
Ảnh của Khanh Hoang

Khanh Hoang - Kenn

Kenn is a user experience designer and front end developer who enjoys creating beautiful and usable web and mobile experiences.

Bình luận (0)

 

Add Comment

Filtered HTML

  • Các địa chỉ web và email sẽ tự động được chuyển sang dạng liên kết.
  • Các thẻ HTML được chấp nhận: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Tự động ngắt dòng và đoạn văn.

Plain text

  • No HTML tags allowed.
  • Các địa chỉ web và email sẽ tự động được chuyển sang dạng liên kết.
  • Tự động ngắt dòng và đoạn văn.
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.

Tìm kiếm bất động sản

 

Advertisement

 

jobsora

Dich vu khu trung tphcm

Dich vu diet chuot tphcm

Dich vu diet con trung

Quảng Cáo Bài Viết

 
Hướng dẫn định dạng dữ liệu tốt hơn trong excel

Hướng dẫn định dạng dữ liệu tốt hơn trong excel

Một trong những việc mà người mới dùng Excel ngại nhất là định dạng dữ liệu, thường người dùng

Các công việc cần thiết xây dựng website công ty bằng Drupal 8

Các công việc cần thiết xây dựng website công ty bằng Drupal 8

Last week, we launched our new company site built in Drupal 8. Previously, it was a Drupal 6 site

keyword để Seo

Cách chọn keyword để Seo thành công

Chọn từ khóa nào để cạnh tranh thứ hạng trên các công cụ tìm kiếm là một quyết định quan trọng. Nếu quyết định không chính xác, cả một chương trình cạnh tranh hàng chục ngày, chi phí hàng triệu đồng sẽ chỉ có ý nghĩa như một bài học để rút kinh nghiệm.

Công ty diệt chuột T&C

 

Diet con trung