install MySQL in rpm mode under CentOS
CentOS version: CentOS-7
MySQL version: MySQL-5.6.22
After searching the internet, there are three ways of installing MySQL under Linux:
1) Download the installation online via the Yum command
2) Download offline RPM installation package installation
3) Download source code compilation installation
Mode 1 is not intended to be used, because most of our project servers are not directly on the Internet, there are many tutorials on online installation, and mode 3 is not necessary for anyone applying MySQL to superfluous.
1. Unzip the downloaded Zip package and you will find the following RPM packages:
mysql-client-advanced-5.6.22-1.el7.x86_64.rpm
mysql-devel-advanced-5.6.22-1.el7.x86_64.rpm
mysql-embedded-advanced-5.6.22-1.el7.x86_64.rpm
mysql-server-advanced-5.6.22-1.el7.x86_64.rpm
mysql-shared-advanced-5.6.22-1.el7.x86_64.rpm
mysql-shared-compat-advanced-5.6.22-1.el7.x86_64.rpm
mysql-test-advanced-5.6.22-1.el7.x86_64.rpm
2. Uninstalling MARIADB
If you click on the RPM package installation you will get an error message. Because the CentOS default database is no longer MySQL, but mariadb, why?
MARIADB database management System is a branch of MySQL, mainly by the open source community in the maintenance, the use of GPL license. One of the reasons for developing this branch is that after Oracle acquired MySQL, there is a potential risk of shutting MySQL out of the source, so the community uses a branching approach to avoid this risk. MARIADB is designed to be fully compatible with MySQL, including APIs and command lines, making it easy to be a replacement for MySQL.
To view the currently installed MARIADB package:
[Email protected] Desktop]# Rpm-qa | grep mariadb
Remove them all forcibly:
[Email protected] Desktop]# rpm-e--nodeps mariadb-libs-5.5.35-3.el7.x86_64
[Email protected] Desktop]# rpm-e--nodeps mariadb-5.5.35-3.el7.x86_64
[Email protected] Desktop]# rpm-e--nodeps mariadb-server-5.5.35-3.el7.x86_64
3. Install MySQL
Double-click the following three packages for automatic installation:
mysql-server-advanced-5.6.22-1.el7.x86_64.rpm
mysql-client-advanced-5.6.22-1.el7.x86_64.rpm
MYSQL-DEVEL-ADVANCED-5.6.22-1.EL7.X86_64.RPM (can not be installed)
Hint: In fact, the second package devel I do not know what to do, do not know whether it is necessary (Internet search should not be necessary), no test whether it must have been point to install, do not want to take the time to test whether it must be, have tested friends trouble message to inform.
Upload the mysql-rpm package to the virtual machine first (using the Xmanager tool)
Note: You must log in using the root user, install the rpm using the rpm-i command, install the mysql-server-rpm first, and then install the mysql-client-rpm.
1). Install mysql-server-rpm
2). Use Cat/root/.mysql_secret to view the password in the red box for the MySQL root user's random password.
3). Re-install mysql-client-rpm
4. Start MySQL
[[email protected] desktop] #service mysql start
Get error: error! The server quit without updating PID file
We are here mainly because: SELinux, if it is a CentOS system, the default is to turn on SELinux. The workaround is to close it, open the/etc/selinux/config, change the selinux=enforcing to selinux=disabled, and then save the restart machine.
And then start MySQL again, there's no problem:
[[email protected] desktop] #service mysql start
To view MySQL running status:
[[Email protected] Desktop]# service MySQL status
success! MySQL Running (2377)
5. Change the password of the root user of MySQL
Execute under Shell: mysqladmin-u root-p ' original password ' password ' new password '
-------------------------------------------------Gorgeous split-line--------------------------------------------------------------
two MySQL Chinese problem solving
1. Modify the file/usr/my.cnf in the CentOS7, and add the following separately under [Mysqld],[mysql],[client]
[Mysqld]
Character_set_server = UTF8
[MySQL]
Default-character-set=utf8
[Client]
Default-character-set=utf8
After the modification is complete, restart the MySQL services, service MySQL restart, and then go to MySQL,
Use show variables like ' character% ' to view all the character encodings for MySQL, except Character_set_filesystem and Character_set_dir, the rest are encoded in bits UTF8.
2. Set the encoding format of the remote client, which is usually accessed from the remote client and the remote client has input method. Set the encoding for the remote client to Unicode (UTF-8), for example, to insert Chinese into the table.
I hope this article will help you, there are questions welcome to shoot Bricks ~ ~
CentOS7 installing MySQL and inserting the Chinese problem by RPM solution [original]