Copy collection private, no other meaning, the original blog address:
Https://www.cnblogs.com/walblog/p/9414604.html
MARIADB is installed by default in CentOS, this is the branch of MySQL, but in order to need, it is necessary to install MySQL in the system, and after the installation is complete, you can overwrite the mariadb directly.
1 Download and install the official MySQL Yum Repository (some of the first steps may be an error because you do not have the Yum tool installed)
[[email protected] ~]# yum Install wget
Start installing the MySQL step.
[Email protected] ~]# Wget-i-C http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
Use the command above to download the installation of Yum Repository, about 25KB, then you can directly install Yum.
[Email protected] ~]# yum-y install mysql57-community-release-el7-10.noarch.rpm
After that, the MySQL server starts to install.
[Email protected] ~]# yum-y install Mysql-community-server
This step may take some time, and the previous mariadb will be overwritten when the installation is complete.
2 MySQL Database settings
Start MySQL First
[Email protected] ~]# systemctl start mysqld.service
View MySQL running status, running status
[Email protected] ~]# systemctl status Mysqld.service
At this point, MySQL has started to run normally, but to get into MySQL also need to find the root user's password, the following command can be found in the log file password:
[[email protected] ~]# grep "Password"/var/log/mysqld.log
Enter the database as follows:
[Email protected] ~]# mysql-uroot-p
Modify Password settings check
Mysql> set global validate_password_policy=0;mysql> set global validate_password_length=1;
Enter the initial password and you can't do anything at this time, because MySQL must change the password before you can manipulate the database:
Mysql> ALTER USER ' root ' @ ' localhost ' identified by ' root ';
After the setting is I found above the values, at this time the password can be set up very simple, such as 1234. The password settings to this database are complete.
But at this point, there is a problem, because the Yum Repository is installed, each time the Yum operation will be automatically updated, you need to uninstall this:
[Email protected] ~]# yum-y Remove Mysql57-community-release-el7-10.noarch
OK, finished, see the results.
CentOS7 installing MySQL