Mac下安装新版MySQL5.7
2015-11-07 16:34
585 查看
(1) 停止 MySQL 服务
如果在
如果
(2) 安装新版 MySQL
旧版目录如下
下载并安装新版,安装过程中出现如下信息
为 root 生成了一个随机密码。
新版目录如下
(3) 启动 MySQL
如果在
也可以使用命令启动
(4) 便捷设置
为方便使用 MySQL
重启终端生效
(6) 使用生成密码登录
需要修改密码。
(6) 修改密码
修改密码
然后要求输入老密码
需要设置权限
然后,重新设置密码。
(7) 旧数据转移
将旧版本数据库的
如果在
System Preferences中有
MySQL图标,则进入点击
Stop MySQL Server。
如果
System Preferences中没有
MySQL,则在 Terminal 中
sudo /usr/local/mysql/support-files/mysql.server stop
(2) 安装新版 MySQL
旧版目录如下
/usr/local/mysql /usr/local/mysql-5.6.25-osx10.8-x86_64
下载并安装新版,安装过程中出现如下信息
2015-10-24T17:22:13.767265Z 1 [Note] A temporary password is generated for root@localhost: t?,oZi*5BwST If you lose this password, please consult the section How to Reset the Root Password in the MySQL reference manual.
为 root 生成了一个随机密码。
新版目录如下
/usr/local/mysql-5.7.9-osx10.9-x86_64
(3) 启动 MySQL
如果在
System Preferences中有
MySQL图标,则进入点击
Stop MySQL Server启动。
也可以使用命令启动
sudo /usr/local/mysql/support-files/mysql.server start
(4) 便捷设置
为方便使用 MySQL
cd /etc sudo chmod +w bashrc sudo vi bashrc #在bashrc最后添加下面两行 alias mysql='/usr/local/mysql/bin/mysql' alias mysqladmin='/usr/local/mysql/bin/mysqladmin'
重启终端生效
(6) 使用生成密码登录
WeiHeLi:~ weiheli$ mysql -uroot -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 322 Server version: 5.7.9 Copyright (c) 2000, 2015, 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> show databases; ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
需要修改密码。
(6) 修改密码
修改密码
# 设置新密码为`root` mysqladmin -u root -p password root
然后要求输入老密码
t?,oZi*5BwST
mysqladmin: [Warning] Using a password on the command line interface can be insecure. Warning: Since password will be sent to server in plain text, use ssl connection to ensure password safety. mysqladmin: unable to change password; error: 'File './mysql/user.MYD' not found (Errcode: 13 - Permission denied)'
需要设置权限
sudo chown -R mysql /usr/local/mysql/data/
然后,重新设置密码。
(7) 旧数据转移
将旧版本数据库的
data文件复制到新版数据库的
data中去。
相关文章推荐
- mysql使用过程中碰到的问题
- MySQL忘记密码怎么办
- 修改mysql DataDir方式
- 基于MySQL5.7MHA的配置
- Windows下Mysql解压缩版配置安装与卸载
- jsp程序向调用mysql语句操作数据库传中文出现乱码
- mysql中的关键字
- 通过innobackupex实现对MySQL的完整热备份
- mysql处理中文乱码的问题
- mysql学习笔记(1)
- MYSQL源码 姜承尧---网易
- 何登成 MYSQL 博客
- MYSQL 源码- 淘宝数据库研发组
- MySQL索引
- mysql_1
- MySQL7:性能优化
- MySQL5:触发器
- MySQL6:视图
- MySQL3:存储过程和函数
- MySQL4:索引