Centos7.3 mounting Mysql5.7.26 (glibc i.e. linux Universal)

1. Check the firewall is turned off

// Check firewall status 
Firewall-cmd - State
 // turn off the firewall 
systemctl STOP firewalld 
systemctl disable firewalld

2. Uninstall Centos7 comes Mariadb

rpm -e --nodeps Mariadb******

3. Create a user group and want to turn off

groupadd mysql
useradd -g mysql mysql

4, the installation dependencies

yum -y install libaio

5. Edit Profile

cp /home/mysql-5.7.26-linux-glibc2.12-x86_64/support-files/my-default.cnf /etc/my.cnf 
// If there is no my-default.cnf, directly edit / etc / my .cnf
Enter the following in /etc/my.cnf
[mysqld] 
Port = 3306 
# Set installation directory 
the basedir = / Home / mysql / mysql5. 7.26 
# setting data mysql database storage directory 
DATADIR = / Home / mysql / mysql5. 7.26 / Data 
Socket = / Home / mysql / mysql5. 7.26 / tmp / mysql.sock 
the User = MySQL 
TMPDIR = / Home / MySQL / mysql5. 7.26 / tmp 
# ip turn bind 
the bind -address = 0.0 . 0.0 
# allow the maximum number of connections 
max_connections = 200 
# service-side character set used by default 8-bit coded character set latin1 
#MySQL of "utf8mb4" is the real "UTF - 8" 
Character -set-Server = utf8mb4 
collation -server = utf8mb4_general_ci 
default storage engine when creating a new table # will use 
default -storage-Engine = INNODB 
innodb_buffer_pool_size = 64MB 
max_allowed_packet = 16M 
 
[mysqld_safe] 
log -error = / Home / MySQL / mysql5 . 7.26 / Data / the error.log 
PID - File . = / Home / mysql / mysql5 7.26 / Data / mysql.pid 
 
[mysql] 
# mysql client set the default character set 
default -CHARACTER-sET = utf8mb4 
 
[client]  
# specify the client file server socket communication path connecting mysql
Socket=/home/mysql/mysql5.7.26/tmp/mysql.sock
default-character-set=utf8mb4
!includedir /etc/my.cnf.d

6. initialization mysqld

[mysql@smallcloud mysql5.7.26]$ ./bin/mysqld --initialize --user=mysql --basedir=/home/mysql/mysql5.7.26 --datadir=/home/mysql/mysql5.7.26/data
//启动mysql服务: 
[mysql@smallcloud mysql5.7.26]$ ./support-files/mysql.server start

7. Set the boot

// copy the startup script to the resource directory (folder requires new mysqld) 
[root @ smallcloud ~] # cp /home/mysql/mysql5.7.26/support-files/mysql.server /etc/init.d/mysqld
// increase mysqld service control script execute permissions:
[root @ smallcloud ~] # chmod + the X-/etc/rc.d/init.d/mysqld
// will be added to the system service mysqld service:
[root @ smallcloud Home] # chkconfig --add mysqld
// check mysqld service is already in force:
[root @ smallcloud Home] # chkconfig --list mysqld

8. Set Environment Variables

[root@smallcloud home]# vim /home/mysql/.bash_profile
  export PATH=$PATH:/home/mysql/mysql5.7.26/bin
[root@smallcloud home]# source /home/mysql/.bash_profile

9. Log in and change your password

[mysql@smallcloud ~]$ mysql -uroot -p
mysql> set password=password('密码')
mysql> quit

 

Guess you like

Origin www.cnblogs.com/sjxbg/p/11084516.html
Recommended