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
class="hljs-button signin active" data-title="登录复制" data-report-click="{"spm":"1001.2101.3001.4334"}">
Change the password for root ? ((Press y|Y for Yes, any other key for No): y
class="hljs-button signin active" data-title="登录复制" data-report-click="{"spm":"1001.2101.3001.4334"}">
New password:
Re-enter new password:
class="hljs-button signin active" data-title="登录复制" data-report-click="{"spm":"1001.2101.3001.4334"}">
1
2
你需要输入两次相同的新密码。如果两次输入的密码一致,系统将更新root用户的密码。
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
class="hljs-button signin active" data-title="登录复制" data-report-click="{"spm":"1001.2101.3001.4334"}">
建议: 如果密码强度高,可以继续使用这个密码。选择 y 继续。 下边配置需要特别注意!!! 除了最后一个,我们千万都不要选y,一路n或者其他拒绝符号!!!
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? (Press y|Y for Yes, any other key for No): n
Success.
class="hljs-button signin active" data-title="登录复制" data-report-click="{"spm":"1001.2101.3001.4334"}">
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? (Press y|Y for Yes, any other key for No): n
... skipping.
class="hljs-button signin active" data-title="登录复制" data-report-click="{"spm":"1001.2101.3001.4334"}">
1
2
3
4
5
6
解释: 默认情况下,root 用户只能从本地主机(localhost)登录。这可以防止通过网络进行暴力破解攻击尝试。选择 n 表示允许 root 用户远程登录。
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? (Press y|Y for Yes, any other key for No): n
... skipping.
class="hljs-button signin active" data-title="登录复制" data-report-click="{"spm":"1001.2101.3001.4334"}">
1
2
3
4
5
6
7
8
解释: MySQL 默认安装时包含一个名为 test 的数据库,任何人都可以访问。这是为了测试用途,但在生产环境中不安全。选择 n 表示保留测试数据库。
Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.
Reload privilege tables now? (Press y|Y for Yes, any other key for No): y
... skipping.
class="hljs-button signin active" data-title="登录复制" data-report-click="{"spm":"1001.2101.3001.4334"}">
1
2
3
4
5
解释: 重新加载权限表可以确保所有更改立即生效。选择 n 表示暂不重新加载权限表。
验证MySQL安装
在终端中运行以下命令,使用root用户登录MySQL:
mysql -u root -p
class="hljs-button signin active" data-title="登录复制" data-report-click="{"spm":"1001.2101.3001.4334"}">
brew services start mysql
class="hljs-button signin active" data-title="登录复制" data-report-click="{"spm":"1001.2101.3001.4334"}">
1
连接Navicat
我满心欢喜的打开Navicat输入完账号密码却弹出来报错信息
2002 - Can’t connect to server on ‘127.0.0.1’ (36)
解决方法: 首先,确保MySQL服务正在运行:
brew services list
class="hljs-button signin active" data-title="登录复制" data-report-click="{"spm":"1001.2101.3001.4334"}">
1
如果使用这行命令又报错
Name Status User File
mysql error 256 ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
class="hljs-button signin active" data-title="登录复制" data-report-click="{"spm":"1001.2101.3001.4334"}">
评论记录:
回复评论: