当前位置:网站首页>Linux Yum install MySQL
Linux Yum install MySQL
2022-07-06 11:49:00 【@Little snail】
Be careful : Only need master Node installation mysql
First loading mysql Source , Put it on again mysql
Catalog
- 2.1 Switch root user ( password :zkpk)
- 2.2 View and uninstall the system's own mariadb-lib database
- 2.3 add to MySQL yum Source
- 2.4 install MySQL
- 2.5 start-up MySQL service
- 2.6 Set boot up
- 2.7 modify root Default password
- 2.8 modify mysql Password policy
- 2.9 modify root The password for zkpk
- 2.10 add to zkpk Users and give remote login permission , And then quit mysql Command line
- 2.11 The configuration default code is utf8
- 2.12 Check if the firewall is turned off
- 2.13MySQL Several important catalogues of
2.1 Switch root user ( password :zkpk)
[[email protected] ~]# su root
2.2 View and uninstall the system's own mariadb-lib database
[[email protected] zkpk]# rpm -qa|grep mariadb
mariadb-libs-5.5.56-2.el7.x86_64
[[email protected] zkpk]# yum -y remove mariadb-libs-*
2.3 add to MySQL yum Source
Be careful : This step requires networking
2.3.1 download mysql Source installation package
[[email protected] zkpk]# wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
2.3.2 install mysql Source
[[email protected] zkpk]# yum -y localinstall mysql57-community-release-el7-8.noarch.rpm
2.3.3 Check mysql Source installed successfully
[[email protected] zkpk]# yum repolist enabled | grep "mysql.*-community.*"

2.4 install MySQL
Be careful : install mysql On the server side , The client is automatically installed as a dependency
[r[email protected] zkpk]# yum -y install mysql-community-server

2.5 start-up MySQL service
2.5.1 command
[[email protected] zkpk]# systemctl start mysqld
2.5.2 see MySQL Start state of ( Green appears in the figure running Words indicate success )
[[email protected] zkpk]# systemctl status mysqld

2.6 Set boot up
[[email protected] zkpk]# systemctl enable mysqld
# Reload the systemd, Scan for new or changed units
[[email protected] zkpk]# systemctl daemon-reload
2.7 modify root Default password
2.7.1 see mysql Install the generated random default password (/var/log/mysqld.log In file )
[[email protected] zkpk]# grep 'temporary password' /var/log/mysqld.log

2.7.2 Sign in mysql( The password is marked in the red box above )
[[email protected] zkpk]# mysql -uroot -p
2.7.3 modify mysql The password for “MyNewPass4!”( Suggest the first )
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!';
perhaps :
mysql> set password for 'root'@'localhost'=password('MyNewPass4!');
Be careful :mysql5.7 The password security check plug-in is installed by default (validate_password), The default password checking policy requires that the password must contain : Case letters 、 Numbers and special symbols , And the length cannot be less than 8 position . Otherwise, it will prompt ERROR
1819 (HY000): Your password does not satisfy the current policy
requirements error , As shown in the figure below :

2.8 modify mysql Password policy
2.8.1 see msyql Information about password policy ; sign out mysql Command line
mysql> show variables like '%password%';
mysql> exit;

2.8.2 Turn off password policy
2.8.2.1 Ban mysql Password policy , towards my.cnf Add the following configuration at the end of the file (/etc/my.cnf), preservation 、 sign out
[[email protected] zkpk]# vim /etc/my.cnf
validate_password = off
2.8.2.2 Restart mysql Service makes configuration effective :
[[email protected] zkpk]# systemctl restart mysqld
2.9 modify root The password for zkpk
2.9.1 Sign in mysql( password :MyNewPass4!)
[[email protected] zkpk]# mysql -uroot -p
2.9.2 modify mysql Of root User password is zkpk( Suggest the first )
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'zkpk';
perhaps
mysql> set password for 'root'@'localhost'=password('zkpk');
2.10 add to zkpk Users and give remote login permission , And then quit mysql Command line
mysql>grant all on *.* to [email protected]'%' identified by 'zkpk';
mysql>grant all on *.* to [email protected]'localhost' identified by 'zkpk';
mysql>grant all on *.* to [email protected]'master' identified by 'zkpk';
mysql>flush privileges;
mysql>exit;
2.11 The configuration default code is utf8
2.11.1 modify /etc/my.cnf The configuration file , stay [mysqld] Add coding configuration , That is, the red box in the following figure ; preservation 、 sign out
[[email protected] zkpk]# vim /etc/my.cnf
[mysqld]
character_set_server=utf8
init_connect='SET NAMES utf8'

2.11.2 Restart mysql service
[[email protected] zkpk]# systemctl restart mysqld
2.11.3 View the database default encoding
2.11.3.1 Sign in mysql( password :zkpk)
[[email protected] zkpk]# mysql -uroot -p
2.11.3.2 View encoding ; And then quit mysql Command line
mysql> show variables like '%character%';
mysql> exit;

2.12 Check if the firewall is turned off
2.12.1 Carry out orders ; If the lower red box appears dead word , Explain that the firewall is off
[[email protected] zkpk]# systemctl status firewalld

2.12.1 If the firewall is not turned off , Follow these steps . Remote access open firewall mysql Of 3306 port
[[email protected] zkpk]# firewall-cmd --add-port=3306/tcp

2.13MySQL Several important catalogues of
The configuration file :/etc/my.cnf
Log files :/var/log/mysqld.log
Service startup script :/usr/lib/systemd/system/mysqld.service
socket file :/var/run/mysqld/mysqld.pid
Database directory /var/lib/mysql/
The configuration file /usr/share/mysql(mysql.server Commands and configuration files )
Relevant command /usr/bin(mysqladmin mysqldump Wait for the order )
The startup script /etc/rc.d/init.d/( Start script file mysql The catalog of )
边栏推荐
猜你喜欢
随机推荐
Small L's test paper
Are you monitored by the company for sending resumes and logging in to job search websites? Deeply convinced that the product of "behavior awareness system ba" has not been retrieved on the official w
MongoDB
Word排版(小计)
nodejs连接Mysql
Codeforces Round #771 (Div. 2)
Yarn installation and use
[Bluebridge cup 2021 preliminary] weight weighing
Codeforces Round #771 (Div. 2)
[NPUCTF2020]ReadlezPHP
MySQL and C language connection (vs2019 version)
Word排版(小計)
AcWing 242. A simple integer problem (tree array + difference)
Wangeditor rich text reference and table usage
express框架详解
DICOM: Overview
Mtcnn face detection
Face recognition_ recognition
2020 WANGDING cup_ Rosefinch formation_ Web_ nmap
Common regular expression collation





![[蓝桥杯2017初赛]方格分割](/img/e9/e49556d0867840148a60ff4906f78e.png)



