Mac安装 Server version: 5.7.19 MySQL Community Server (GPL)的整个过程

Mac安装Server version: 5.7.19 MySQL Community Server (GPL)的整个过程

1.下载mysql

mysql-5.7.19-macos10.12-x86_64.dmg
2.常规安装-一步一步点击下去安装
mysql-5.7.19-macos10.12-x86_64.dmg




3.打开mysql服务
系统偏好设置里边

点击MySql这个图标-然后选择启动mysql就行了,记着勾选下面的按钮,这样就每次mac开机时,Mysql服务就自动开启了

打开后界面上红色的部分会变成绿色的running

4.mysql 配置路径

用文本编辑器打开.bash_profile加入PATH=$PATH:/usr/local/mysql/bin并保存。我习惯用 Atom 作为文本编辑器,或者直接用自带的 vim 编辑。在命令行输入source ~/.bash_profile路径就配置好了。


以上情况是基于bash的配置方法

simthdeMacBook-Pro:~ a6$ vi ~/.bash_profile
simthdeMacBook-Pro:~ a6$ source ~/.bash_profile


5.登陆并修改密码

mysql -u root -p登陆,输入之前保存的密码


安装完mysql5.7 之后,登陆以后,不管运行任何命令,总是提示这个
You must reset your password using ALTER USER statement before executing this statement.
此时你需要做的是修改密码呢

step 1: SET PASSWORD = PASSWORD(‘your new password‘);

step 2: ALTER USER ‘root‘@‘localhost‘ PASSWORD EXPIRE NEVER;

step 3: flush privileges;


完成以上三步退出再登,使用新设置的密码就行了,以上除了红色的自己修改成新密码外,其他原样输入即可


具体操作如下:
simthdeMacBook-Pro:~ a6$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 223
Server version: 5.7.19

Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.

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.

mysql> show databases;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
mysql> SET PASSWORD = PASSWORD('XXX!123XX456')
    -> ;
Query OK, 0 rows affected, 1 warning (0.00 sec)

就会出现如下提示,这个时候已经更新了密码,但是会有 warning。如果想查看warning,可以用 show warning

mysql> ALTER USER 'root'@'localhost' PASSWORD EXPIRE NEVER;
Query OK, 0 rows affected (0.00 sec)

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

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.00 sec) 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值