当前位置:网站首页>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 )
边栏推荐
猜你喜欢
随机推荐
[BSidesCF_2020]Had_a_bad_day
Integration test practice (1) theoretical basis
Nodejs connect mysql
[MRCTF2020]套娃
[Flink] Flink learning
What does BSP mean
nodejs 详解
Using LinkedHashMap to realize the caching of an LRU algorithm
Nanny level problem setting tutorial
第4阶段 Mysql数据库
[蓝桥杯2021初赛] 砝码称重
MongoDB
XML文件详解:XML是什么、XML配置文件、XML数据文件、XML文件解析教程
Word排版(小计)
FTP文件上传文件实现,定时扫描文件夹上传指定格式文件文件到服务器,C语言实现FTP文件上传详解及代码案例实现
Vert. x: A simple TCP client and server demo
4、安装部署Spark(Spark on Yarn模式)
[mrctf2020] dolls
L2-007 家庭房产 (25 分)
TypeScript