Under linux- Kylin mounted mysql5.7.28

Installation environment: Kylin Desktop version 7.0

Download: https://dev.mysql.com/downloads/mysql/5.7.html

 

A pre-installation preparation

1. Check whether mysql has been installed, execute the command

[root@localhost /]# rpm -qa | grep mysql

From the results, it can be seen that we have installed MySQL-libs-5.1.73-5.el6_6.x86_64 , the delete command

[root@localhost /]# rpm -e --nodeps mysql-libs-5.1.73-5.el6_6.x86_64

 

Executing a query command again to see if deleted

[root@localhost /]# rpm -qa | grep mysql

2, all queries Mysql corresponding folder

[root@localhost /]# whereis mysql
mysql: /usr/bin/mysql /usr/include/mysql
[root@localhost lib]# find / -name mysql
/data/mysql
/data/mysql/mysql

Delete the relevant file or directory

[root@localhost /]#  rm -rf /usr/bin/mysql /usr/include/mysql /data/mysql /data/mysql/mysql

 

Verify that the deletion is complete

[root@localhost /]# whereis mysql
mysql:
[root@localhost /]# find / -name mysql
[root@localhost /]#

 

3, check the mysql user groups and users exists, if not, create

[root@localhost /]# cat /etc/group | grep mysql
[root@localhost /]# cat /etc/passwd |grep mysql
[root@localhost /]# groupadd mysql
[root@localhost /]# useradd -r -g mysql mysql
[root@localhost /]#

 

Two installation Mysql
1, found in the directory wget command execution or under your upload directory Mysql installation package: mysql-5.7.28-linux-glibc2.12 -x86_64.tar.gz
performs decompression command:

[the root @ localhost /] # xzvf the tar-MySQL 5.7.28-Linux-glibc2.12-x86_64.tar.gz
[the root @ localhost /] # LS
MySQL-5.7.28-Linux-glibc2.12 the x86_64-
MySQL-5.7 .28-linux-glibc2.12-x86_64.tar.gz
after extraction is completed, you can see the current directory of more than one-extracting file, move the file to / usr / local / mysql
execute movement commands:

[the root @ localhost /] # Music Videos-MySQL 5.7.28-Linux-glibc2.12-the x86_64 / usr / local / mysql
2, data directory created in the / usr / local / mysql directory

[root @ localhost /] # mkdir / usr / local / mysql / the Data
3, user groups and users to change the mysql directory under all the directories and folders belongs, and permissions

[root@localhost /]# chown -R mysql:mysql /usr/local/mysql
[root@localhost /]# chmod -R 755 /usr/local/mysql

4, the new profile database mysql vim /etc/my.cnf, modified as follows:

[mysqld]
datadir=/usr/local/mysql/data
basedir=/usr/local/mysql
socket=/usr/local/mysql/data/mysql.sock
user=mysql
port=3306
character-set-server=utf8
# 取消密码验证
#skip-grant-tables
#Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
#skip-grant-tables
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
[client]
port=3306
socket=/usr/local/mysql/data/mysql.sock

 

Note that the value of the socket must be the same before and after

Otherwise it will error: of Can not Connect solutions to local MySQL server through socket of

Solution: http://www.cnntt.com/archives/2505

 


4, the compiler installed and initialized mysql, be sure to remember to initialize the log output end of the password (database administrator temporary password)

[root@localhost /]# cd /usr/local/mysql/bin
[root@localhost bin]# ./mysqld --initialize --user=mysql --datadir=/usr/local/mysql/data --basedir=/usr/local/mysql

 

After the completion of the implementation of the steps above this will generate a temporary password
A temporary password is generated for root @ localhost: r # su ## & WF0Xy
added to start the service

cp /usr/local/src/mysql/support-files/mysql.server /etc/init.d/mysql

start the service

service mysql start

to change the root password

 ? ./mysqladmin -uroot -p'89aTo PgZrdB 'password 111111

login mysql (password: 111111)

bin/mysql -u root -p

Published 117 original articles · won praise 4 · views 80000 +

Guess you like

Origin blog.csdn.net/qq_36266449/article/details/103675300