Mac 安装Mysql
Posted zhangshan33
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Mac 安装Mysql相关的知识,希望对你有一定的参考价值。
Mac 安装mysql
提示密码错误,需修改配置文件,重置密码
输入:
sudo /usr/local/mysql/support-files/mysql.server stop回车
提示:
Shutting down MySQL
. SUCCESS!
输入:
cd /usr/local/mysql/bin/回车
提示:
bin
输入:
sudo su回车
提示:
sh-3.2#
输入:
./mysqld_safe --skip-grant-tables &回车
提示:
[1] 10016
sh-3.2# 2019-08-27T13:17:00.6NZ mysqld_safe Logging to '/usr/local/mysql-5.7.27-macos10.14-x86_64/data/zhangshandeMacBook-Pro.local.err'.
2019-08-27T13:17:00.6NZ mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql-5.7.27-macos10.14-x86_64/data
输入:
./mysql回车
提示:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 41
Server version: 5.7.27 MySQL Community Server (GPL)
Copyright (c) 2000, 2019, 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
输入:
FLUSH PRIVILEGES;回车
提示:
Query OK, 0 rows affected (0.01 sec)
输入:
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('123456');回车
提示:
Query OK, 0 rows affected, 1 warning (0.01 sec)
设置密码
输入:
exit回车
退出mysql
输入:
exit回车
退出su权限
输入:
sudo /usr/local/mysql/support-files/mysql.server restart回车
重启服务
Password:
输入:
密码本机密码
提示:
Shutting down MySQL
..2019-08-27T13:21:49.6NZ mysqld_safe mysqld from pid file /usr/local/mysql-5.7.27-macos10.14-x86_64/data/zhangshandeMacBook-Pro.local.pid ended
SUCCESS!
停止mysql成功
Starting MySQL
. SUCCESS!
启动mysql成功
输入:
/usr/local/mysql/bin/mysql -uroot -p回车
Enter password:
输入:
登录数据库的密码123456
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 29
Server version: 5.7.27 MySQL Community Server (GPL)
Copyright (c) 2000, 2019, 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成功
输入:
select user();
以上是关于Mac 安装Mysql的主要内容,如果未能解决你的问题,请参考以下文章
mac 安装mysql5.6后,为啥在/usr/local/下有两个mysql目录