Mac Pro 下MySql的安装及配置使用

一、安装:

https://dev.mysql.com/doc/refman/5.6/en/osx-installation-pkg.html 到这个网址下载,下载之后点击安装(傻瓜式安装),
为什么我要写这篇博客记录下来呢?重点不是它的安装,而是我遇到了一些问题,

二、配置

打开终端
打开配置
输入:.bash_profile
Mac Pro 下MySql的安装及配置使用_第1张图片
输入:export PATH=${PATH}:/usr/local/mysql/bin 保存

然后,在系统偏好设置中打开MySql ,在终端进行登录的时候会出现

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO) 

解决这个问题的办法
1、打开终端输入/usr/local/mysql/bin/mysqld_safe –skip-grant-tables
Mac Pro 下MySql的安装及配置使用_第2张图片
出现上边的结果,然后不要关闭当前的终端,重新打开一个 ,
2、输入/usr/local/mysql/bin/mysql 会展示出

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 37
Server version: 5.7.13 MySQL Community Server (GPL)

Copyright (c) 2000, 2016, 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> 

3、打开use mysql;
结果:

Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed

4、然后更改root的密码

mysql> update user set authentication_string=password('root') where Host='localhost' and User='root';

5、退出保存,重新启动服务 搞定

你可能感兴趣的:(android通用,工作笔记,mysql,mac)