当前位置:网站首页>MySQL usage notes 1
MySQL usage notes 1
2022-07-07 17:08:00 【Python and big data analysis】
MySQL and postgresql It is currently the two popular open source databases , Most domestic databases are derived from this ,MySQL From the whole architecture 、 It is similar in design and grammar to the early Sybase,SQLServer Also derived from Sybase, In terms of application SQLServer More friendly , More features , The performance of a single database is also the best ;MySQL There are also many limitations , But here are just experiments and notes , Do not go into .
1、 First landing MySQL, You need to get the initial password from the log
[[email protected] local]# grep 'temporary password' /var/log/mysqld.log
-06-16T04::36.398736Z [Note] [MY-010454] [Server] A temporary password is generated for [email protected]: oyazXUIps8)F
[[email protected] local]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is
Server version: 8.0.29
Copyright (c) , , Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
2、 The initial password needs to be updated before each operation , Then modify the password policy that meets the needs
mysql> SHOW VARIABLES LIKE 'validate_password.%';
ERROR (HY000): You must reset your password using ALTER USER statement before executing this statement.
mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '[email protected]';
ERROR (HY000): Your password does not satisfy the current policy requirements
mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '1qaz!QAZ';
Query OK, rows affected (0.01 sec)
mysql> SHOW VARIABLES LIKE 'validate_password.%';
+--------------------------------------+--------+
| Variable_name | Value |
+--------------------------------------+--------+
| validate_password.check_user_name | ON |
| validate_password.dictionary_file | |
| validate_password.length | |
| validate_password.mixed_case_count | |
| validate_password.number_count | |
| validate_password.policy | MEDIUM |
| validate_password.special_char_count | |
+--------------------------------------+--------+
rows in set (0.02 sec)
mysql> set global validate_password.length=;
Query OK, rows affected (0.00 sec)
mysql> set global validate_password.policy=;
Query OK, rows affected (0.00 sec)
mysql> set global validate_password.check_user_name=off;
Query OK, rows affected (0.00 sec)
mysql> SHOW VARIABLES LIKE 'validate_password.%';
+--------------------------------------+-------+
| Variable_name | Value |
+--------------------------------------+-------+
| validate_password.check_user_name | OFF |
| validate_password.dictionary_file | |
| validate_password.length | |
| validate_password.mixed_case_count | |
| validate_password.number_count | |
| validate_password.policy | LOW |
| validate_password.special_char_count | |
+--------------------------------------+-------+
rows in set (0.01 sec)
3、 Enter the data , Modify the user table , Ensure that external users can access MySQL
mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> select host,user from user where user='root';
+-----------+------+
| host | user |
+-----------+------+
| localhost | root |
+-----------+------+
row in set (0.00 sec)
mysql> update user set host='%' where user='root';
Query OK, row affected (0.01 sec)
Rows matched: Changed: Warnings:
mysql> select host,user from user where user='root';
+------+------+
| host | user |
+------+------+
| % | root |
+------+------+
row in set (0.00 sec)
4、 to root User external user empowerment
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;
ERROR (): You are not allowed to create a user with GRANT
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;
Query OK, rows affected (0.01 sec)
mysql> FLUSH PRIVILEGES;
Query OK, rows affected (0.01 sec)
mysql>
5、 Modify the configuration file , binding IP Address , Modify firewall again , Ensure that external users can access the port
[[email protected] local]# netstat -anpt
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp ...: ...:* LISTEN /sshd
tcp 127.0..: ...:* LISTEN /master
tcp 192.168.13.50: 123.123.123.2: ESTABLISHED /sshd: [email protected]
tcp 192.168.13.50: 192.168.13.11: ESTABLISHED /sshd: [email protected]
tcp 192.168.13.50: 123.123.123.2: ESTABLISHED /sshd: [email protected]
tcp6 ::: :::* LISTEN /mysqld
tcp6 ::: :::* LISTEN /sshd
tcp6 ::: :::* LISTEN /master
tcp6 ::: :::* LISTEN /mysqld
pid-file=/var/run/mysqld/mysqld.pid
[[email protected] local]# vi /etc/my.cnf
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/8.0/en/server-configuration-defaults.html
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
bind-address=...
"/etc/my.cnf" L, C written
[[email protected] local]# firewall-cmd --zone=public --add-port=3306/tcp --permanent
success
[[email protected] local]# firewall-cmd --reload
success
[[email protected] local]#
Last , Thank you for your attention , Thank you for your support !
边栏推荐
- QT中自定义控件的创建到封装到工具栏过程(一):自定义控件的创建
- User defined view essential knowledge, Android R & D post must ask 30+ advanced interview questions
- typescript ts 基础知识之类型声明
- 模块六
- MRS离线数据分析:通过Flink作业处理OBS数据
- LeetCode 1186. 删除一次得到子数组最大和 每日一题
- LeetCode 1043. Separate the array to get the maximum and daily questions
- 【Seaborn】组合图表、多子图的实现
- Sort out several important Android knowledge and advanced Android development interview questions
- Shallow understanding Net core routing
猜你喜欢
Seaborn数据可视化
字节跳动Android面试,知识点总结+面试题解析
Sator推出Web3游戏“Satorspace” ,并上线Huobi
Mrs offline data analysis: process OBS data through Flink job
Reflections on "product managers must read: five classic innovative thinking models"
最新高频Android面试题目分享,带你一起探究Android事件分发机制
skimage学习(3)——使灰度滤镜适应 RGB 图像、免疫组化染色分离颜色、过滤区域最大值
掌握这个提升路径,面试资料分享
最新Android高级面试题汇总,Android面试题及答案
[Seaborn] combination chart: facetgrid, jointgrid, pairgrid
随机推荐
os、sys、random标准库主要功能
Temperature sensor chip used in temperature detector
Master this set of refined Android advanced interview questions analysis, oppoandroid interview questions
QT picture background color pixel processing method
自定义View必备知识,Android研发岗必问30+道高级面试题
Sort out several important Android knowledge and advanced Android development interview questions
邮件服务器被列入黑名单,如何快速解封?
rpcms获取指定分类下的文章的方法
LeetCode 1986. The minimum working time to complete the task is one question per day
The latest interview experience of Android manufacturers in 2022, Android view+handler+binder
Lie cow count (spring daily question 53)
浅谈 Apache Doris FE 处理查询 SQL 源码解析
DAPP defi NFT LP single and dual currency liquidity mining system development details and source code
从DevOps到MLOps:IT工具怎样向AI工具进化?
【视频/音频数据处理】上海道宁为您带来Elecard下载、试用、教程
Direct dry goods, 100% praise
ATM系统
字节跳动Android金三银四解析,android面试题app
LeetCode 1186. 删除一次得到子数组最大和 每日一题
99% 用户在 Power BI 云端报表常犯错误