在mac上使用tar.gz安装mysql
官方:
- download: https://dev.mysql.com/downloads/mysql/
- mysql参考文档:https://dev.mysql.com/doc/
环境:
- macOS Mojave 10.14.2
用户:
- 管理员用户,期间没有新建mysql用户或组
安装包:
- mysql-8.0.13-macos10.14-x86_64.tar.gz
安装配置
1.解压
下载的tar.gz解压后,并移动到/usr/local/mysql,目录结构如下:
$ pwd
/usr/local
$ tree mysql -L 1
mysql
├── LICENSE
├── LICENSE.router
├── README
├── README.router
├── bin
├── data
├── docs
├── include
├── lib
├── man
├── run
├── share
└── support-files
实际上是按照Unix目录结构的规范,建议这么做。
本人实际操作过程中,只是通过sudo ln -s ${MYSQL_HOME} /usr/local/mysql
,创建了一个软链接。
解压命令:tar -xzvf ${filename}
2.修改权限:sudo chown -R usr:group /usr/local/mysql
3.初始化
$ cd /usr/local/mysql
$ bin/mysqld --initialize --user=ephemerid --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
2019-01-20T05:50:19.601053Z 0 [System] [MY-013169] [Server] /Workspaces/programfiles/mysql-8.0.13-macos10.14-x86_64/bin/mysqld (mysqld 8.0.13) initializing of server in progress as process 1045
2019-01-20T05:50:19.603274Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /usr/local/mysql/data/ is case insensitive
2019-01-20T05:50:21.143953Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: A_mBvrbnD0*r
2019-01-20T05:50:22.000946Z 0 [System] [MY-013170] [Server] /Workspaces/programfiles/mysql-8.0.13-macos10.14-x86_64/bin/mysqld (mysqld 8.0.13) initializing of server has completed
ephemerid是我的用户名,改成自己的。
后面两个选项的含义,见后文MY-011011。
前面提到过,本人使用了软链接,所以控制台信息中看到的mysql实际的目录。
注意这个“A temporary password is generated for root@localhost”
5.启动
$ support-files/mysql.server start
Starting MySQL
. SUCCESS!
6.连接及修改初始密码
$ bin/mysql -uroot -pA_mBvrbnD0*r
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.13
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> show databases;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'pass123456';
Query OK, 0 rows affected (0.02 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
4 rows in set (0.01 sec)
mysql> exit
Bye
!!!平常输入密码的时候不要直接添加在-p
选项后面了,会被看到的,一定要注意安全!!!
第一次登陆时,会提示需要重置密码:
ALTER USER 'root'@'localhost' IDENTIFIED BY 'pass123456';
7.停止服务
$ support-files/mysql.server stop
Shutting down MySQL
.. SUCCESS!
EORROR
The server quit without updating PID file
在未初始化,就启动时出现了:
$ sudo ./support-files/mysql.server start
Password:
Starting MySQL
. ERROR! The server quit without updating PID file (/usr/local/mysql/data/ephemerid.local.pid).
解决
初始化一下,即上文提到的mysqld --initialize
MY-011011
在初始化时,没有找到有效的mysql目录以及mysql data目录。
$ sudo ./bin/mysqld --initaialize --user=ephemerid
2019-01-20T05:13:45.476844Z 0 [System] [MY-010116] [Server] /Workspaces/programfiles/mysql-8.0.13-macos10.14-x86_64/bin/mysqld (mysqld 8.0.13) starting as process 993
2019-01-20T05:13:45.480320Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /Workspaces/programfiles/mysql-8.0.13-macos10.14-x86_64/data/ is case insensitive
2019-01-20T05:13:45.487935Z 1 [ERROR] [MY-011011] [Server] Failed to find valid data directory.
2019-01-20T05:13:45.488090Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2019-01-20T05:13:45.488119Z 0 [ERROR] [MY-010119] [Server] Aborting
2019-01-20T05:13:45.488808Z 0 [System] [MY-010910] [Server] /Workspaces/programfiles/mysql-8.0.13-macos10.14-x86_64/bin/mysqld: Shutdown complete (mysqld 8.0.13) MySQL Community Server - GPL.
解决
就是添加的两个选项,即上文提到的--basedir
和--datadir
了解更多,参考:
以上。
在mac上使用tar.gz安装mysql的更多相关文章
- 【mysql】mac上基于tar.gz包安装mysql服务
一.准备工作 (1)下载mysql-5.7.21-macos10.13-x86_64.tar.gz,并将该压缩包移动至/usr/local目录下 (2)解压压缩包 二.安装 (1)将解压的包重命名为m ...
- redis centos 上以 tar.gz 安装redis
1.下载安装文件#wget http://download.redis.io/releases/redis-3.2.3.tar.gz 2.删除文件 rm -rf /usr/local/redisrm ...
- 关于MySQL-python-1.2.3.tar.gz安装失败的解决方案
关于MySQL-python-1.2.3.tar.gz安装失败的解决方案 RHEL6.4升级到python2.7.9,然后安装 MySQL-python-1.2.3.tar.gz, 报错.解决错误之后 ...
- qq for linux tar.gz安装
借用官网的一段话 QQ for Linux 怎么命令行安装和卸载 RPM版本 安装 ①打开控制台,使用管理员身份登录 :②在终端中输入命令“rpm –U package_name.rpm“ , pac ...
- 如何在 Mac 上通过 Boot Camp 安装 Windows?
如何在 Mac 上通过 Boot Camp 安装 Windows? The following contents are chosen from the apple website, thanks f ...
- Mac上go的下载安装教程
mac上go的下载安装教程 官网https://golang.google.cn/dl/下载,安装 环境变量配置 参考https://www.jianshu.com/p/5c1873eaf3ca Ba ...
- 在 Windows 上使用压缩文件 安装 MySQL
在 Windows 上使用压缩文件 安装 MySQL 1. 下载 MySQL mysql-5.7.27-win32.zip:二进制文件; 服务器类型: mysqld 2. 解压 mysql-5.7.2 ...
- Mac 上 Apache Apollo 的安装与运行,和官方下载文件中 Python 实例的演示
前不久我在 Mac 上成功安装了 mosquitto,这次我又试了试安装另一个热门的 broker —— Apache Apollo.对在 Mac 上安装 mosquitto 感兴趣的可以点击查看我的 ...
- 在LINUX系统上通过LINUX命令安装mysql数据库和JDK环境
此示例通过Winscp工具和Xshell已验证通过 安装示例1: 在Centos6.5上安装JDK-10.0.2版本 检查LINUX系统是否有自带或者安装过的JDK版本:Java -version 查 ...
随机推荐
- Android深入四大组件(四)Android8.0 根Activity启动过程(前篇)
前言 在几个月前我写了Android深入四大组件(一)应用程序启动过程(前篇)和Android深入四大组件(一)应用程序启动过程(后篇)这两篇文章,它们都是基于Android 7.0,当我开始阅读An ...
- 求最大公约数和最大公倍数(Java算法)
最大公约数(最大公因数):指某几个整数共有约数中最大的一个. 求两个整数最大公约数主要的方法: 列举法:各自列出约数,再找出最大的公约数. 素因数分解法:两数各作素因数分解,然后取出共有的项乘起来. ...
- pmp心得
我报名比较晚,等缴费最后期限,才缴费,下定决心,开始正式的备考. 我的工作比较忙,备考时间特比较短,从拿到书到考试只有二个月了,心理慌慌的,期间还有一门其他的考试,在5月底,实际时间只能有20来天. ...
- 实战:Nginx如何让用户通过用户名和密码认证访问WEB站点
有时我们会有这么一种需求,就是你的网站并不想提供一个公共的访问或者某些页面不希望公开,我们希望的是某些特定的客户端可以访问.那么我们可以在访问时要求进行身份认证,就如给你自己的家门加一把锁,以拒绝那些 ...
- Scratch www 系统搭建
原文地址:https://blog.csdn.net/litianquan/article/details/82735809 Scratch www要基于Nodejs的环境才可以运行,我尝试了在Win ...
- laravel入门-01
创建laravel应用 laravel new app_name 使用 PHP 内置 web server 驱动我们的网站 cd xxx/public php -S localhost:port 查看 ...
- mysql那些招
show table status mysql官方文档在 http://dev.mysql.com/doc/refman/5.1/en/show-table-status.html 这里的rows行是 ...
- phpstrom设置php环境
phpstorm设置自动同步服务器 Tools->Deployment->Confinguration 点+号,添加服务器,类型SFTP,输入name 点击ok,项目与服务器连接成功! 设 ...
- 深入浅出SharePoint——定制保存Item按钮
<script type="text/javascript" src="/_layouts/style/jquery-1.4.4.min.js">& ...
- January 01 2017 Week 1st Sunday
This is a new year. A new beginning. And things will change. 新一年,新开始,新气象. Hey Hey Hey. I can see my ...