Install and configure MySQL in CentOS
MySQL is preferred. The first MySQL database version is released on Linux. Other options include postgreSQL and Oracle.
Install the mysql database on Linux. You can download the rpm package of the MySQL database from its official website.
Here, I use yum to install the MySQL database. By using this method, we can install MySQL-related services and jar packages.
-------------------------------------- Split line --------------------------------------
If you are interested, you can also read this article:
Install MySQL 5.6.23 in Linux
The following is the MySQL-related content carefully selected by the editor to see if it is helpful:
Install MySQL 5.6 with the source code in CentOS 7
How to install and configure MySQL5.7.3.0
Install MySQL in Ubuntu 14.04
MySQL authoritative guide (original book version 2nd) Clear Chinese scan PDF
Ubuntu 14.04 LTS install LNMP Nginx \ PHP5 (PHP-FPM) \ MySQL
Build a MySQL Master/Slave server in Ubuntu 14.04
Build a highly available distributed MySQL cluster using Ubuntu 12.04 LTS
Install MySQL5.6 and Python-MySQLdb in the source code of Ubuntu 12.04
MySQL-5.5.38 universal binary Installation
-------------------------------------- Split line --------------------------------------
The following is the official start:
1. Check whether the mysql database is included in the System
[Root @ liang ~] # Rpm-qa | grep mysql // This command will check whether the mysql database has been installed on the Operating System
Run this command to check whether mysql has been installed in the system. You can see that my system is clean and no version of mysql has been installed. If your system has been installed, you can choose to uninstall it.
[Root @ liang ~] # Rpm-e mysql // normal deletion Mode
[Root @ liang ~] # Rpm-e -- nodeps mysql // strong deletion mode. If the above command is used to delete other dependent files, you can use this command to forcibly delete them.
Ii. Use the yum command to install mysql
[Root @ liang ~] # Yum list | grep mysql
Run the command to view the mysql version information downloaded from yum.
Run the following command to install the database:
[Root @ liang ~] # Yum install-y mysql-server mysql-deve
After waiting for a while, output:
The installation is successful! Run the following command to view the version of the installed database:
[Root @ liang ~] # Rpm-qi mysql-server
Iii. mysql database initialization and related configuration
After installing the mysql database, we will find an additional mysqld service. This is our database service. We can start our mysql service by entering the service mysqld start command.
Note: if we start the mysql service for the first time, the mysql server will first perform Initialization Configuration, for example:
At this time, we will see that a lot of information will be prompted after the mysql server is started for the first time. The purpose is to initialize the mysql database. When we restart the mysql service again, so much information will not be prompted.
When using the mysql database, we have to start the mysqld service first. We can run the chkconfig -- list | grep mysqld command to check whether the mysql service is automatically started when it is started, if you find that the mysqld service is not automatically started upon startup, you can use the chkconfig mysqld on command to set it to start upon startup, so that you do not need to start it manually every time.
After the mysql database is installed, there will be only one root administrator account, but the root account has not set a password for it. When the mysql service is started for the first time, some database initialization will be performed, in a large string of output information, we can see such a line of information:
We can use this command to set the password as root for the root user.
Now we can log on to our mysql database using the mysql-u root-p command.
For more details, please continue to read the highlights on the next page: