Installation and commissioning of MySQL database under CentOS

Source: Internet
Author: User

Bo Master is a beginner of Linux, decided to record the learning process of the bit, as a growth record, as a reference to Yimeimei study, in short, the blog is there, we picking, just don't let him alone good.

First, persistent data is a program-critical module that coincides with the deployment of the CentOS operating system on the blogger's project, so start by installing the MySQL database. Maybe you think the content is relatively simple, but it doesn't matter, the person will say it is simple; Bo Master only to use the simplest description, to meet the "no-one" of the studious.

There are two main ways, one is to download the installation package and install it, and one is to pass the Yum command. Bloggers feel that through the Yum command is relatively simple, so decided to use this method.

1. Install MySQL

yum-y Install Mysql-server

2. View all MySQL directories

rpm–ql MySQL

3. Start MySQL

/etc/rc.d/init.d/mysqld Start or service mysqld start

If it is unsuccessful, it can be handled differently depending on the specific message, and in general, it will appear:

REMEMBER to SET A PASSWORD for the MySQL root user!

You can set the password for user root first .

3.1 Set password for user root:/usr/bin/mysqladmin–u root password ' 123456 ' ( Note that the usr/bin/mysqladmin here is different depending on the installation directory, Can be viewed according to 1 steps )

3.2 After the setup is complete, rerun service mysqld start, which appears:

Starting mysqld: [OK]

Indicates a successful start.

4. Set up MySQL service boot

Chkconfig mysqld on

5. See if the setting is successful

chkconfig–list mysqld (if 2-5 shows on, it indicates start-up )

6. log in to MySQL

Mysql–u Root–p after the prompt to enter the password can be.

7. Check if login is successful

You can run MySQL's instructions to test your results. For example: show databases;

8. Authorizing remote access to the database

Grant all privileges on * * to ' root ' @ '% ' identified by ' 123456 ' with GRANT option;

Flush privileges;

' Root ': Indicates the user name authorized for remote access

'% ': Indicates that the remote computer authorized to access ip,% represents all

' 123456 ': Indicates a database password for authorizing remote access

9.Question & Answer

If remote access is not available at this time, you can view firewall-related

9.1 View Instructions:/etc/init.d/iptables status

9.2 Turn off firewall directive:/etc/init.d/iptables stop

10. Summary

Review the above content, mainly introduced, MySQL database installation, start the database, set the database user name, password, set up MySQL boot, authorize remote access and so on. At last, the problems in the installation process of bloggers are introduced. If you have any other problems, please feel free to communicate.

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.