CentOS 6.5 installation configuration MySQL database

Source: Internet
Author: User
Tags mysql client mysql version

First, MySQL Introduction

When it comes to databases, we mostly think of relational databases, such as MySQL, Oracle, SQL Server, and so on, which are very easy to install on Windows, and if you want to install a database on Linux, I have to recommend MySQL database first. And the first version of the MySQL database is distributed on Linux systems.

MySQL is a relational database management system developed by the Swedish MySQL AB company, currently owned by Oracle Corporation. MySQL is an associated database management system that keeps data in separate tables rather than putting all of the data in a large warehouse, which increases speed and increases flexibility. MySQL's SQL language is the most commonly used standardized language for accessing databases. MySQL software uses a dual licensing policy (this term "authorization policy"), it is divided into community and commercial version, because of its small size, speed, low total cost of ownership, especially the open source of this feature, the general small and medium-sized web site development has chosen MySQL as the site database. Thanks to the performance of its community edition, PHP and Apache make a good development environment.

To install MySQL database on Linux, we can download the MySQL database rpm package on its official website, Http://dev.mysql.com/downloads/mysql/5.6.html#downloads, Everyone can download the corresponding database files according to their operating system, the latest version is 5.6.10.

Here I am the installation of MySQL database through Yum, this way to install, can be related to MySQL some services, jar packages are installed to us, so save a lot of unnecessary trouble!!!

Second, uninstall the original MySQL

Because MySQL database is very popular on Linux, so the mainstream Linux version of the current download basically integrates the MySQL database inside, we can use the following command to see whether the MySQL database is installed on our operating system.

Rpm-qa | grep mysql//check if the MySQL database is already installed on the operating system

If yes, we can uninstall it by RPM-E command or rpm-e--nodeps command.

RPM-E MySQL//normal Delete mode

RPM-E--nodeps MySQL//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 List | 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 .

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

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

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] Desktop]# service mysqld startInitialize MySQL database: warning:the host ' Xiaoluo ' could not being looked up with RESOLVEIP. This probably means that your libc libraries is not the Compatiblewith this binary MySQL version. The MySQL daemon, mysqld, should worknormally with the exception that host name resolving won't work. This means the should use IP addresses instead of Hostnameswhen specifying MySQL privileges! Installing MySQL system tables ... Okfilling Help Tables ... OKto start mysqld at boot time has to copysupport-files/mysql.server to the right place for your systemplease Remembe R to SET A PASSWORD for the MySQL root USER! To does so, start the server, then issue 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_  Installationwhich would also give you the option of removing the testdatabases and anonymous user created by default. This isstrongly recommended for production servers. See the Manual for more instructions. You can start the MySQL daemon with:cd/usr; /usr/bin/mysqld_safe &you can test the MySQL daemon with mysql-test-run.plcd/usr/mysql-test;                                                           Perl mysql-test-run.plplease Report No problems with The/usr/bin/mysqlbug script! [OK] 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, we can use the service mysqld restart command to restart the MySQL service, will not prompt so much information, such as:

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:

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 it doesn't have to be started manually every time.

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 password for 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 ' Probe '//Use this command to set the root account password to probe

At this point we can log in to our MySQL database via the mysql-u root-p command, enter the password you just set.

V. Major configuration files for MySQL database

1. /etc/my.cnf This is the main configuration file for MySQL

We can take a look at some information about this file

2. /var/lib/mysql This is where the database files are stored in the MySQL database

The database files for our MySQL database are usually stored in the/ver/lib/mysql directory.


We can create a database ourselves to verify where the database files are stored

After creating a Java-named database, enter exit to exit and then enter ls-l under MySQL file to see the new Java database file we just created

3. /var/log MySQL database log output storage location

Some of our MySQL database's log output is stored in the/var/log directory

Where mysqld.log This file is the log information that we have to store our operations with the MySQL database, and we can get a lot of information by looking at the log file.

Because our MySQL database is accessible over the network, not a stand-alone database, where the protocol used is the TCP/IP protocol, the MySQL database binding port number is 3306, so we can see through the NETSTAT-ANP command, is the Linux system listening on the 3306 port number:

As shown above, the 3306 port number that the Linux system listens to is our MySQL database.

This is the end of installing the MySQL database with Yum under CentOS6.5 and the basic configuration of the database!



CentOS 6.5 installation configuration MySQL database

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.