当前位置:网站首页>[worthy of collection] centos7 installation MySQL complete operation command
[worthy of collection] centos7 installation MySQL complete operation command
2022-06-27 11:02:00 【InfoQ】
Preface
Get ready
Practice
1. uninstall
pkill -9 mysqld
rpm -qa|grep -i mysql
yum -y remove mysql-community-client-5.6.38-2.el7.x86_64
What cannot be unloaded rpm -ev

2. download mysql Of repo Source
wget http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpmrpm -qpl mysql57-community-release-el7-7.noarch.rpmrpm -ivh mysql57-community-release-el7-7.noarch.rpmyum list mysql*yum install mysql-community-servermysql -V3. Set up mysql password
systemctl stop mysqld.servicevi /etc/my.cfg# Disabling symbolic-links is recommended to prevent assorted security risks
skip-grant-tables # Add this sentence , Now log in mysql You don't need a password
symbolic-links=0systemctl start mysqld.serviceset password for [email protected]=password('123456'); or update user set authentication_string=PASSWORD("123456") where user="root";mysql -u root -p # Enter the command enter , You can enter the password directly .
mysql> set password for [email protected] = password('123456');
ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> set password for [email protected] = password('123456'); or update user set authentication_string=PASSWORD("123456") where user="root";
Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql>flush privileges; # Update the permissions
mysql>quit; # sign out MySQL8.0
grep 'temporary password' /var/log/mysqld.log // Generate random password mysql -uroot -p // Log in with a random password 1. Change the password corresponding to the user name
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY ' New password '; // Change Password create user [email protected]'%' identified by ' Your password ';
grant all privileges on *.* to [email protected]'%' with grant option;
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY ' Your password ';
flush privileges; # Update the permissions 2. modify /etc/my.cnf add to skip-grant-tables Skip authentication login
vim /etc/my.cnf // modify my.cnf file
// stay [mysqld] Add... To any of the following lines "skip-grant-tables" Used to skip the password verification process , Save and exit .
mysql -uroot -p // Sign in , No password required
// Login successful :
use mysql; // Switch to mysql library
select host,user,authentication_string from user; // You can see root User host And password ( After encryption )
3.mysql8.0 In addition to the password Field , Change to authentication_string
update user set authentication_string = '' where user = 'root';
// Leave the password blank ,my.cnf Get rid of skip-grant-tables You can still log in with an empty password .
vim /etc/my.cnf
// edit my.cnf file Remove the previously added "skip-grant-tables", You can still log in with an empty password
show variables like 'validate_password%';

validate_password.check_user_name User name detection
validate_password.dictionary_file Specify the file path for password verification ;
validate_password.length Total fixed length password ;
validate_password.mixed_case_count The whole password should contain at least large / The total number of lowercase letters ;
validate_password.number_count The whole password must contain at least the number of Arabic numerals ;
validate_password.policy Specify the strength verification level of the password , The default is MEDIUM;
About validate_password_policy The value of :
0/LOW: Verify length only ;
1/MEDIUM: Verify the length 、 Numbers 、 Case write 、 Special characters ;
2/STRONG: Verify the length 、 Numbers 、 Case write 、 Special characters 、 Dictionary file ;
validate_password.special_char_count The whole password should contain at least the number of special characters set global validate_password.policy=LOW; // Set password strength to LOW
After the policy is modified , Change Password :
alter user 'root'@'localhost' identified by 'root'; // Change the password to root, It indicates that the modification is successful 边栏推荐
- Evolution of software system architecture
- Quelles sont les fonctions de base nécessaires au développement d'applications de commerce électronique en direct? Quelles sont les perspectives d'avenir?
- 软件系统架构的演变
- Oracle-分组统计查询
- 2021 CSP J2 entry group csp-s2 improvement group round 2 video and question solution
- 【TcaplusDB知识库】TcaplusDB-tcaplusadmin工具介绍
- 【TcaplusDB知识库】TcaplusDB数据构造介绍
- Dimitt's law
- Mail system (based on SMTP protocol and POP3 protocol -c language implementation)
- 【Methodot 专题】什么样的低代码平台更适合开发者?
猜你喜欢
随机推荐
ECMAScript 6(es6)
Co jump
Glide缓存机制
Deep understanding of happens before principle
杰理之睡眠以后定时唤醒系统继续跑不复位【篇】
Co jump
JS all network request modes
Ubuntu manually installing MySQL
实验笔记之——CARMEN (.log .clf)文件转换为rosbag
Quelles sont les fonctions de base nécessaires au développement d'applications de commerce électronique en direct? Quelles sont les perspectives d'avenir?
在外企远程办公是什么体验? | 社区征文
[tcapulusdb knowledge base] tcapulusdb business data backup introduction
What basic functions are required for live e-commerce application development? What is the future development prospect?
直播電子商務應用程序開發需要什麼基本功能?未來發展前景如何?
Audiotrack and audiolinker
audiotrack与audioflinger
2021 CSP J2 entry group csp-s2 improvement group round 2 video and question solution
What is the experience of telecommuting in a foreign company| Community essay solicitation
【TcaplusDB知识库】Tmonitor单机安装指引介绍(一)
ECMAScript 6(es6)









