0%

mysql8.0 安装后设置账号密码 和IDE远程连接

如果不是第一次安装有可能遇到mysql密码加密问题到 /usr/local/var 下删除 mysql数据库

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
brew install mysql
安装完成后
执行
mysql_secure_installation
第一次安装输入新密码 还会提示你密码强度自己选就可以
第二次执行mysql_secure_installation就需要输入上一次的密码
提示 :在提示输入 Press y|Y for Yes, any other key for No 输入No的时候一定要写全
----
Securing the MySQL server deployment.

Enter password for user root:
The 'validate_password' component is installed on the server.
The subsequent steps will run with the existing configuration
of the component.
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
是否修改密码
----

----
By default, a MySQL installation has an anonymous user, allowing anyone

to log into MySQL without having to have a user account created for

them. This is intended only for testing, and to make the installation

go a bit smoother. You should remove them before moving into a

production environment.

Remove anonymous users? [Y/n]
生产环境建议删除系统创建的匿名用户 Y
----

----
Normally, root should only be allowed to connect from 'localhost'. This

ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n]
禁止root用户远程登录 Y
----

----
By default, MySQL comes with a database named 'test' that anyone can

access. This is also intended only for testing, and should be removed

before moving into a production environment.

Remove test database and access to it? [Y/n]
删除test数据库 Y
----

----
Reloading the privilege tables will ensure that all changes made so far

will take effect immediately.

Reload privilege tables now? [Y/n]
重载权限表 Y
----

以上选择根据自己的选项输入

到此有个问题不能远程连接IDE
解决方法:
mysql -uroot -p (输入自己的密码)
use mysql;

ALTER USER 'root'@'localhost' IDENTIFIED BY 'password' PASSWORD EXPIRE NEVER;
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
FLUSH PRIVILEGES;
正常可以连接了

参考:
Navicat 连接 MySql8.0( You are not allowed to create a user with GRANT)
mysql_secure_installation 安全安装(用于生产环境设置)

如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!