当前位置:网站首页>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 )
边栏推荐
- Codeforces Round #753 (Div. 3)
- 小L的试卷
- [CDH] cdh5.16 configuring the setting of yarn task centralized allocation does not take effect
- Hutool中那些常用的工具类和方法
- Wangeditor rich text component - copy available
- Valentine's Day flirting with girls to force a small way, one can learn
- Solution to the practice set of ladder race LV1 (all)
- Yarn installation and use
- L2-007 家庭房产 (25 分)
- MATLAB学习和实战 随手记
猜你喜欢
Redis面试题
Mysql的索引实现之B树和B+树
Pytoch Foundation
Linux yum安装MySQL
Pytorch基础
AcWing 1298. Solution to Cao Chong's pig raising problem
Solve the problem of installing failed building wheel for pilot
QT creator custom build process
error C4996: ‘strcpy‘: This function or variable may be unsafe. Consider using strcpy_ s instead
{一周总结}带你走进js知识的海洋
随机推荐
L2-006 树的遍历 (25 分)
Redis面试题
[BSidesCF_2020]Had_ a_ bad_ day
What does BSP mean
搞笑漫画:程序员的逻辑
Vs2019 first MFC Application
Learn winpwn (3) -- sEH from scratch
分布式节点免密登录
Why can't STM32 download the program
ES6 promise object
L2-006 tree traversal (25 points)
AcWing 179. Factorial decomposition problem solution
互联网协议详解
double转int精度丢失问题
MySQL与c语言连接(vs2019版)
nodejs连接Mysql
ImportError: libmysqlclient. so. 20: Cannot open shared object file: no such file or directory solution
Distribute wxWidgets application
[蓝桥杯2017初赛]包子凑数
Codeforces Round #771 (Div. 2)