mysql远程可视化工具连接linux数据库各种问题记录

安装mysql设置密码

运行以下命令查看/var/log/mysqld.log文件,获取并记录root用户的初始密码。
grep 'temporary password' /var/log/mysqld.log
命令行返回结果如下,其中ARQTRy3+n8*W为MySQL的初始密码。在下一步重置root用户密码时,会使用该初始密码。
2021-11-10T07:01:26.595215Z 1 [Note] A temporary password is generated for root@localhost: ARQTRy3+n8*W
The existing password for the user account root has expired. Please set a new password.

New password: #输入新密码。长度为8至30个字符,必须同时包含大小写英文字母、数字和特殊符号。特殊符号包含()` ~!@#$%^&*-+=|{}[]:;‘<>,.?/

Re-enter new password: #确认新密码。
The 'validate_password' plugin is installed on the server.
The subsequent steps will run with the existing configuration
of the plugin.
Using existing password for root.

Estimated strength of the password: 100 #返回结果包含您设置的密码强度。
Change the password for root ? ((Press y|Y for Yes, any other key for No) :Y #您需要输入Y以确认使用新密码。

#新密码设置完成后,需要再次验证新密码。
New password:#再次输入新密码。

Re-enter new password:#再次确认新密码。

Estimated strength of the password: 100
Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) :Y #您需要输入Y,再次确认使用新密码。

安装问题自己去阿里云找
 

1.确认是否放开了3306端口,阿里云/宝塔/命令 各种方式

 2.先 看看mysql -u root -p "密码" 能连接不,如果连接不上 

1.vim /etc/my.cnf
在[mysqld]后面任意一行添加

2.skip-grant-tables

用来跳过密码验证的过程

3.service mysqld restart   
重启服务

4.mysql -u root -p   连续两次回车 不需要输密码

5.
mysql> grant all privileges on *.* to 'root'@'%' identified by 'root';

ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
这个错就是你密码格式太简单了

 SHOW VARIABLES LIKE 'validate_password%';
+--------------------------------------+--------+
| Variable_name                        | Value  |
+--------------------------------------+--------+
| validate_password_check_user_name    | OFF    |
| validate_password_dictionary_file    |        |
| validate_password_length             | 8      |
| validate_password_mixed_case_count   | 1      |
| validate_password_number_count       | 1      |
| validate_password_policy             | MEDIUM |
| validate_password_special_char_count | 1      |
+--------------------------------------+--------+

一顿无脑操作再刷新一下
1.最短4个字符

mysql> set global validate_password_length=4;
Query OK, 0 rows affected (0.00 sec)
2.

mysql> set global validate_password_policy=0;
Query OK, 0 rows affected (0.00 sec)
3.设置 % 就是外网通配

mysql> grant all privileges on *.* to 'root'@'%' identified by 'root';
Query OK, 0 rows affected, 1 warning (0.00 sec)
4.

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

5.夸夸一顿试 发现这个字段是密码
6.果然 % 的密码跟别的不一样,那不你连不上谁连不上

mysql> select host,user,authentication_string from user;
+-----------+---------------+-------------------------------------------+
| host      | user          | authentication_string                     |
+-----------+---------------+-------------------------------------------+
| localhost | root          | *6BB4837EB74329105EE45                    |
| localhost | mysql.session | *THISISNOTAVALIDPASSWO                    |
| localhost | mysql.sys     | *THISISNOTAVALIDPASSWOR                   |
| %         | root          | *81F5E21E35407D884A6CDB                   |
+-----------+---------------+-------------------------------------------+
4 rows in set (0.00 sec)


7.设置一下 密码为123456

mysql> ALTER USER 'root'@'%' IDENTIFIED BY '123456';
Query OK, 0 rows affected (0.00 sec)

mysql> 
mysql> 
mysql> 
mysql> select host,user,authentication_string from user;
+-----------+---------------+-------------------------------------------+
| host      | user          | authentication_string                     |
+-----------+---------------+-------------------------------------------+
| localhost | root          | *6BB4837EB74329105E                       |
| localhost | mysql.session | *THISISNOTAVALIDPAS                       |
| localhost | mysql.sys     | *THISISNOTAVALIDPAS                       |
| %         | root          | *6BB4837EB74329105E                       |
+-----------+---------------+-------------------------------------------+
4 rows in set (0.00 sec)

远程工具一试,好使了

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值