Install MySQL under centos6.5

Source: Internet
Author: User
Tags mysql client

First, remove the original MySQL

grep mysql//This command will check if the MySQL database is already installed on the operating system

If there is, we can unload it by RPM-E command or rpm-e--nodeps command.

[[Email protected] ~]# RPM- normal Delete mode Brute force Delete mode, if you use the above command to delete, prompted to have other dependent files, then use this command can be strongly deleted

After the deletion we can pass Rpm-qa | grep mysql command to see if MySQL has been uninstalled successfully!!

Third, the installation of MySQL through Yum

I am using yum to perform MySQL database installation, first we can enter Yum List | grep mysql command to view the downloadable version of the MySQL database available on Yum:

Yum grep MySQL

You can get the downloadable version of the MySQL database on the Yum server:

Then we can install the MySQL mysql-server mysql-devel by entering the yum install-y mysql-server mysql mysql-devel command ( Note: When we installed MySQL, we did not install the MySQL client, which is equivalent to installing the MySQL database, we also need to install the Mysql-server server .

Yum Install -y mysql-server mysql Mysql-deve

After waiting for some time, Yum will help us choose the software needed to install the MySQL database and some other ancillary software.

We found that the installation of the MySQL database through the Yum method eliminates a lot of unnecessary hassle, and when the following results occur, the MySQL database installation is successful.

At this point we can view the version of the mysql-server that we just installed with the following command

[Email protected] ~]# Rpm-qi mysql-server

We installed the Mysql-server is not the latest version, if you want to try the latest version, then go to the MySQL website to download rpm package installation, so that our MySQL database has been installed.

Iv. initialization of MySQL database and related configuration

After we install the MySQL database, we will find a mysqld service, this is our database service, we can start our MySQL service by entering the service mysqld start command.

Note : If we are starting the MySQL service for the first time, the MySQL server will first initialize the configuration, such as:

[[Email protected] ~]# Service mysqld start initializing MySQL database: Warning:the host'Xiaoluo'Could not being looked up with Resolveip. This probably means that your libc libraries is not -%compatiblewith This binary MySQL version. The MySQL daemon, mysqld, should worknormally with the exception that host name resolving won't work. This means, should use IP addresses instead of Hostnameswhen specifying MySQL privileges!Installing MySQL system tables ... Okfilling Help Tables ... OKto start mysqld at boot TimeYou have to Copysupport-files/mysql.server to the right place foryour systemplease REMEMBER to SET A PASSWORD for the MySQL root USER! to DoSo, start the server, Thenissue the following commands:/usr/bin/mysqladmin-u Root Password'New-password'/usr/bin/mysqladmin-u root-h xiaoluo Password'New-password'Alternatively you can run:/usr/bin/mysql_secure_installationwhichWould also give you the option of removing the testdatabases and anonymous user created by default. This isstrongly recommended forproduction servers. See the manual for  Moreinstructions. You can start the MySQL daemon with:cd/usr; /usr/bin/mysqld_safe &can test the MySQL daemon with MySQL-test-RUN.PLCD/usr/mysql-test;Perlmysql-test-run.plplease Report any problems with the/usr/bin/mysqlbug script![OK] is starting mysqld: [OK]

At this point we will see that the first time you start the MySQL server will prompt a lot of information, the purpose is to initialize the MySQL database, when we restart the MySQL service again, will not prompt so much information, such as:

[[Email protected] ~Service mysqld Restart stop mysqld:                                             [OK] starting mysqld:                                          [OK]

When we use MySQL database, we have to start the Mysqld service first, we can check the MySQL service is not started automatically by chkconfig--list | grep mysqld command, such as:

grep mysqldmysqld              0: Off    1: Off    2: Off    3: Off    4: Off    5: Off    6: Off

We found that the MYSQLD service did not start automatically, and of course we can set it to boot up with the chkconfig mysqld on command, so you don't have to start it manually every time.

[[Email protected] ~grep  mysqlmysqld             0: Off    1: Off    2 : Enable    3: Enable    4: Enable    5: Enable    6: Off

MySQL database after installation will only have a root administrator account, but at this time the root account has not set a password for it, the first time the MySQL service started, the database will be some initialization work, in the output of a large string of information, we see a line of information:

/usr/bin/mysqladmin-u root password ' New-password  ' //Set the password for the root account

So we can use this command to set the password for our root account ( Note : This root account is the root account of MySQL, not the root account of Linux )

mysqladmin-u root Password ' Root '//Use this command to set the root account password to root

At this point we can log in to our MySQL database via the mysql-u root-p command.


Two, remote access settings

Modify the password of the root user of MySQL and open the remote connection

[[email protected] mysql]# mysql-u root MySQL

mysql> use MySQL;
mysql> desc User;
Mysql> GRANT All privileges on * * to [email protected] '% ' identified by ' root '; The ability to add remote connections for root
mysql> Update user Set Password = Password (' 123456 ') where user= ' root '; Set the root user password
Mysql> Select Host,user,password from User where user= ' root ';
mysql> flush Privileges;
Mysql> exit



Install MySQL under centos6.5

Related Article

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.