码迷,mamicode.com
首页 > 数据库 > 详细

Mac 安装Mysql

时间:2019-08-28 11:11:49      阅读:99      评论:0      收藏:0      [点我收藏+]

标签:macos   and   回车   down   book   启动mysql   sel   cti   monitor   

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

标签:macos   and   回车   down   book   启动mysql   sel   cti   monitor   

原文地址:https://www.cnblogs.com/zhangshan33/p/11422400.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!