Install MySQL database in CentOS
Because I want to deploy a Java project on CentOS, this project requires database operations, so the first thing is to install the database! Now I will take you step by step to install the MySQL database.
First, in CentOS, we can directly install the database using the yum command. Before installing the database, check whether the MySQL database has been installed on CentOS. If yes, uninstall it first.
(1) check whether the MySQL database is installed.
[Root @ localhost/] # rpm-qa | grep mysql
The result is as follows:
This indicates that the database has been installed, and we can uninstall it first...
(2) uninstall
There are two ways to detach a file: normal deletion and strong deletion. When the MySQL database has other dependent files, the file is also deleted.
Are: rpm-e mysql and rpm-e -- nodeps mysql
(3) Installation Process
First, run the command: yum list | grep mysql to view the downloadable version of the database provided on yum.
We choose to install mysql. i686, mysql-devel.i686, mysql-server.i686 on the line. Run the following command:
Yum-y install mysql-server mysql-devel
You can install the MySQL database...
(4) Database Configuration
After installing the MySQL database, you will find that there is an additional mysqld service, which is our database service and starting it is to start the database.
Start method: service mysqld start
Run the command chkconfig -- list | grep mysqld to check whether Automatic startup is enabled. If 2 ~ All five are on.
It indicates that the instance is automatically started upon startup. Otherwise, if it is not. We can use the command chkconfig mysqld on to set it to boot automatically.
Well, here we should start the database to set the password.
(5) database password settings
Start the mysqld service, that is, service mysqld start, and then execute the command
Mysqladmin-u root-p password 'root'
This means to set the password of the root user as root. Now we can log on to the MySQL database.
Here, I will describe all the database installation steps.
Next, let's take a look at the database configuration file.
The configuration file of the database is etc/my. cnf. The content is as follows:
Datadir is the storage path of the MySQL database. It indicates that my data is stored in the/var/lib/mysql directory of CentOS.
The above mysql and test are the default two database files after the database is installed.
Another database log file is stored in var/log/mysqld. log.
-------------------------------------- Split line --------------------------------------
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 --------------------------------------
This article permanently updates the link address: