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

本文档详细介绍了在MacOS环境下安装MySQL的过程,并针对安装过程中遇到的访问权限问题提供了详细的解决方案,包括如何通过终端修改root用户的默认密码。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

一、安装:

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

二、配置

打开终端
打开配置
输入:.bash_profile
这里写图片描述
输入: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
这里写图片描述
出现上边的结果,然后不要关闭当前的终端,重新打开一个 ,
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、退出保存,重新启动服务 搞定

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值