首页 技术 正文
技术 2022年11月18日
0 收藏 367 点赞 3,899 浏览 2039 个字

系统环境: OS X Yosemite 10.10.3

登录用户: fx (有 sudo 权限)

MySQL版本: 5.5.49 (mysql-5.5.49-osx10.9-x86_64.tar)

MySQL下载: http://dev.mysql.com/downloads/mysql/

找到下载的 MySQL tar.gz 文件位置, 浏览器下载的一般在当前用户的 Downloads 目录, 即 /Users//Downloads,进入终端, 解压 tar.gz 文件:

cd /Users//Downloads

tar zxvf mysql-5.6.24-osx10.9-x86_64.tar.gz

解压完成后得到 mysql-5.5.49-osx10.9-x86_64 目录, 移动解压目录到 MySQL 默认安装路径 /usr/local/mysql下, /usr/local 路径不存在时,

先 sudo mkdir /usr/local 创建。

# 移动解压后的二进制包到安装目录

sudo mv mysql-5.5.49-osx10.9-x86_64 /usr/local/mysql

# 更改 mysql 安装目录所属用户与用户组

cd /usr/local

sudo chown -R root:wheel mysql

# 执行 scripts 目录下的mysql_install_db 脚本完成一些默认的初始化(创建默认配置文件、授权表等)

cd /usr/local/mysql

sudo scripts/mysql_install_db –user=mysql

注意: MySQL 5.7.6 以上版本取消了 scripts 目录, 初始化命令改成了

sudo bin/mysqld –initialize –user=mysql

安装完成, 测试启动、重启与停止:

cd /usr/local/mysql

# 启动

sudo support-files/mysql.server start

# 重启

sudo support-files/mysql.server restart

# 停止

sudo support-files/mysql.server stop

# 检查 MySQL 运行状态

sudo support-files/mysql.server status

一、初始化 MySQL root 密码

# 需要 MySQL 服务在运行状态执行

cd /usr/local/mysql/bin

./mysqladmin -u root -p password 新密码

#输入生成的临时密码,回车

修改成功会返回:

<!–
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000; background-color: #ffffff}
span.s1 {font-variant-ligatures: no-common-ligatures}
–>

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.

连接登陆到mysql:

cd mysql/bin

./mysql -u root -p

#输入密码

登陆成功:

<!–
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000; background-color: #ffffff}
p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000; background-color: #ffffff; min-height: 13.0px}
span.s1 {font-variant-ligatures: no-common-ligatures}
–>

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 21

Server version: 8.0.11 MySQL Community Server – GPL

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

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,110
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,584
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,431
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,202
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,837
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,920