mac下刚安装的mysql忘记密码的解决办法

-----情景:总是出现类似的错误-----

C:\Program Files\MySQL\MySQL Server 5.0\bin>mysql

ERROR 1045 (28000): Access denied for user 'ODBC'@'localhost' (using password: N
O)

-----解决方案-----

1.没有忘记mysql登陆密码的话

(本人主机上密码暂时是我名字拼音)

mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.7.20 MySQL Community Server (GPL)

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>

2.如果忘记mysql登陆密码了

则重新安装mysql dmg安装包,则会重新分配一个密码(5.7.23左右版本才有,5.6都没有):

有时发现重新安装出现不了这个密码,则去/usr/local下路径删除下mysql的文件,重新安装即可

3)重新设置root密码:

SET PASSWORD = PASSWORD('jianan123456');

有时候怎么输都不对,这是需要先关闭mysql,然后再次

安装-->重启-->输入

3.导入数据库

创建数据库

create database pomelo;

use pomelo;

展示当前所有数据库

show databases;

用source命令根据备份的mysql.sql语句导入数据库

mysql> source /Users/jianan/Documents/StudyMaster/bycw_nodejs_game/bycw_server/sql/bycw_game_node.sql

4.有时候,安装完mysql客户端,输入mysql无法识别,这是没有加入环境变量的原因

export PATH="/usr/local/mysql-8.0.12-macos10.13-x86_64/bin:$PATH"

5.mysql gui 客户端sequelpro

Sequel Pro

这样可以在选择数据库后,方便查看表格的信息。

6.mysql官方下载地址

MySQL :: Download MySQL Community Server

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值