First, install MySQL
1. Download MySQL installation package https://dev.mysql.com/downloads/
I downloaded the Mysql-5.6.36-1.linux_glibc2.5.x86_64.rpm-bundle.tar.
2. Pass the installation package to any directory on Linux
3. Unzip the installation package tar XVF Mysql-5.6.36-1.linux_glibc2.5.x86_64.rpm-bundle.tar
Just install mysql-client-5.6.36-1.linux_glibc2.5.x86_64.rpm and mysql-server-5.6.36-1.linux_glibc2.5.x86_64.rpm here.
4, install the check before the program, to prevent MySQL installation conflict or failure
1) Check if mysql:rpm-qa|grep-i MySQL is installed, if installed, use rpm-e--nodeps xxx to remove the installed program.
2) Check if MARIADB:RPM-QA is already installed | Grep-i mariadb, if installed, remove the installed program with RPM-E--nodeps mariadb-libs-5.5.52-1.el7.x86_64
3) Install the dependent packages (deleting mariadb will delete some dependencies, so you need to install the corresponding dependency package at this time)
Yum install-y Perl Perl-devel
Yum Install-y Perl-data-dumper
Some systems may also have a dependency package installed as follows: (I don't need the following dependencies when I install)
Yum-y Install libaio.so.1 libgcc_s.so.1 libstdc++.so.6
Yum Update libstdc++-4.4.7-4.el6.x86_64
Ps:sun Company acquired MySQL, due to the issue of charges, so CentOS7 is actually not installed MySQL, but the default installation of MARIADB, so remember if it is CentOS7 install MySQL, you must delete mariadb
5. Install MySQL
1) Install mysql server:rpm-ivh mysql-server-5.6.36-1.linux_glibc2.5.x86_64.rpm
At this point you will see a message in the console
This message indicates that MySQL generated a default initial password in the . Mysql_secret file. Based on security, the default password is now not an empty string when MySQL is installed.
Open the. Mysql_secret:vi. mysql_secret can see the corresponding initial password
2) Install the MySQL client:RPM-IVH mysql-client-5.6.36-1.linux_glibc2.5.x86_64.rpm
3) After successful installation, you can enter mysql:rpm-qa|grep-i mysql, will show the program you have installed
6. Connect MySQL
1) Turn on the MySQL services:serviceMySQL start
2) connect mysql:mysql-u root-p, when you enter the password, there will be the following display
3) Change root password
when we enter the corresponding mysql command (show Databases), the system will prompt us to modify the mysql password
This is a password that can be changed directly:update user set Password=password (' CHENSR ') where user= ' root ';
you can also quit MySQL (enter quit), Change Password externally:mysqladmin-u root-p password "CHENSR"
at this point, our MySQL installation is successful!
Second, set the boot automatically start
1. Add MySQL to the system service: Chkconfig-add MySQL
2. Set auto-open: chkconfig MySQL off
3. View system service Chkconfig--list
Third, set the boot automatically start
If you use external software to connect to MySQL, you will find that you cannot connect
At this point we need to give root Telnet permission and open port 3306
1 ) We log in to MySQL , giving Root users have MySQL permissions, including remote login permissions :
Permissions Granted: Grant all privileges on * * to ' root ' @ '% ' identified by ' CHENSR '
Refresh Permissions: Flush Privileges
2) Turn on port 3306
/sbin/iptables-i input-p TCP--dport 3306-j ACCEPT
This will allow you to successfully access the database remotely!
Error during installation:
1) conflicts with file from the package mariadb-libs-5.5.52-1.el7.x86_64
Solution: This is because the centOs default installation of the database is mariadb, resulting in conflict with MySQL , only need to delete the Rpm-e--nodeps mariadb-libs-5.5.52-1.el7.x86_64
2) FATAL Error:please Install the following Perl modules before executing/usr/bin/mysql_install_db
Solution: This is because the corresponding component is missing, just install the corresponding component:
Yum install-y Perl Perl-devel
Yum Install-y Perl-data-dumper
3) Can ' t connect to local MySQL server through socket '/VAR/LIB/MYSQL/MYSQL.SOC
see this on the Internet may be caused by a number of reasons, but my problem here is because root does not have /var/lib/mysql/ operation permissions, so add the corresponding permissions can be Chown-r Root:root/var/lib/mysql
1. Install MySQL
CentOS 7 Installation MySQL