当前位置:网站首页>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)
- [Flink] cdh/cdp Flink on Yan log configuration
- Vert. x: A simple login access demo (simple use of router)
- How to configure flymcu (STM32 serial port download software) is shown in super detail
- Antlr4 uses keywords as identifiers
- Some concepts often asked in database interview
- Hutool中那些常用的工具类和方法
- ES6 promise object
- QT creator uses Valgrind code analysis tool
- Word typesetting (subtotal)
猜你喜欢
随机推荐
Case analysis of data inconsistency caused by Pt OSC table change
error C4996: ‘strcpy‘: This function or variable may be unsafe. Consider using strcpy_s instead
【kerberos】深入理解kerberos票据生命周期
error C4996: ‘strcpy‘: This function or variable may be unsafe. Consider using strcpy_ s instead
[yarn] yarn container log cleaning
常用正则表达式整理
快来走进JVM吧
[NPUCTF2020]ReadlezPHP
L2-007 family real estate (25 points)
[BSidesCF_2020]Had_a_bad_day
Those commonly used tool classes and methods in hutool
Nanny level problem setting tutorial
Redis面试题
AcWing 179. Factorial decomposition problem solution
ES6 Promise 对象
Aborted connection 1055898 to db:
Vs2019 first MFC Application
Wangeditor rich text reference and table usage
wangeditor富文本引用、表格使用问题
分布式節點免密登錄