Recently because the company's server needs to be done at baseline and vulnerability scanning, baselines not a big problem, according to the recommendations on strengthening the report, choose some high weight problem to handle it just fine. However, vulnerability scanning is more pit, and sweep out a dozen more than 160 high-risk and moderate-risk vulnerabilities, though basically a loophole in the openSSH and mysql, upgrade at these two versions like . Because it is cloud hosting openSSH dares, so we put mysql upgrade to the latest version. centos and can not be directly run window quick and easy as the upgrade package, so our approach is unloading heavy equipment.
Uninstall mysql
First, the data inside the database to back up what
$> mysqldump -u root -p --all-databases > backdb.sql
Enter the password to start the backup, the backup file will be placed after the completion of the current directory, use the ll command to see
By whereis mysql and which mysql to find the mysql folder by rm command to delete a folder, delete the profile /etc/my.cnf
View the current MySQL: RPM - qa | grep MySQL
Did not show any content to the next step, if there is then output through yum remove keep mysql behind the line of output content to delete
After deleting mysql, ready to start re-installed.
Download mysql
Because the server is pure network, it can only be installed by source. mysql download: https: //dev.mysql.com/downloads/mysql/
At its option, you need to download version 5.7 is installed as before, so in order to ensure that data is not a problem, this is still ready to install 5.7.
The latest version is 5.7.27, the other by selecting the picture, 64-bit or 32-bit will depend on the system itself can getconf LONG_BIT view commands.
Install mysql
Under uploaded to the server in the / usr / local / directory after the download is complete
Decompression: tar -zxvf (file name) and then through the mv command folder name changed to mysql
Creating user groups and users
User Group: groupadd MySQL
User: the useradd - R & lt - G MySQL MySQL
Mysql user to specify the specific users and user groups
Enter mysql folder: cd / usr / local / mysql
Create a data directory: mkdir data
Specified users and user groups
cd /usr/local/
chown -R mysql mysql/
chgrp -R mysql mysql/
Mysql initialization
Go to the bin directory: cd / usr / local / MySQL / bin
./mysqld --initialize --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data/ --lc_messages_dir=/usr/local/mysql/share --lc_messages=en_US
Remember rearmost temporary password, if you forget the password or want to re-initialize it first mysql / data directory, delete the file, and then execute initialization commands.
My.cnf Configuration
vi / etc / my.cnf not, then automatically creates
Enter the following:
[mysqld] basedir=/usr/local/mysql/ datadir=/usr/local/mysql/data/
Start mysql
cd /usr/local/mysql/bin
./mysqld_safe --user=mysql &
I actually got this far when there was bug, output display linxu daemon has been started, but PS - EF | grep mysql always find mysql process, this time if you go to Baidu, it will get a variety the answer may not apply to you, the best way is to see the mysql error log, usually stored in the mysql directory data folder suffix is .err. If not, can the Find / - name hostname .err Find command, the host name can hostnamectl view commands. To find the problem will be more targeted by error, I later found missing from the configuration file played two letters, careless kill people, ah! ! !
Landing mysql
cd /usr/local/mysql/bin
Login: . / MySQL - U root - the p-
After logging on mysql, you must change your password before other operations
Change Password: the SET password = password ( "root");
Registration Authority: Grant All privileges ON * * to'root '@'% 'IDENTIFIED by' root ';.
Authorization to take effect: flush privileges ;
So far mysql and install the upgrade is complete, the file is now conducting a backup before returning inside mysql
Enter a database: use MySQL;
Set coding: SET names UTF8;
Import sql file: Source ...... / backdb.sql;