代码改变世界

mac安装mysql及导库

2021-04-26 17:58  Tanwheey  阅读(70)  评论(0编辑  收藏  举报

1、执行安装命令

$brew install mysql

2、安装完后启动mysql

$mysql.server start

3、执行安全设置

$mysql_secure_installation

显示如下

There are three levels of password validation policy:

 

LOW    Length >= 8

MEDIUM Length >= 8, numeric, mixed case, and special characters

STRONG Length >= 8, numeric, mixed case, special characters and dictionary                  file

按照提示选择密码等级,并设置root密码

二、导库

1、登录mysql

$mysql -u root -p

按提示输入root密码

root@poksi-test-2019:~# mysql -u root -p

Enter password:

$mysql>source d:/dbname.sql

三、检查mysql服务状态

先退出mysql命令行,输入命令

$mysql.server status

显示如下结果说明mysql服务是正常的

 SUCCESS! MySQL running (23753)