文档章节

macOS安装和配置MySQL5.7

秋风醉了
 秋风醉了
发布于 2016/09/24 17:14
字数 605
阅读 98
收藏 0

macOS安装和配置MySQL5.7

官方推荐的安装方法请看:https://dev.mysql.com/doc/refman/5.7/en/binary-installation.html

下载最新的mysql tar.gz 包,把解压缩后的包移动到 /usr/local 目录下,

sudo mv mysql-5.7.15-osx10.11-x86_64 /usr/local/mysql

修改目录的权限

sudo chown -R xinxingegeya:wheel mysql

初始化mysql,

➜  mysql bin/mysqld --initialize --user=xinxingegeya --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
2016-09-25T06:41:00.870572Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-09-25T06:41:00.880225Z 0 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/mysql/data/ is case insensitive
2016-09-25T06:41:01.034242Z 0 [Warning] InnoDB: New log files created, LSN=45790
2016-09-25T06:41:01.060623Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2016-09-25T06:41:01.124713Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 0604438e-82eb-11e6-ac32-baec7272e731.
2016-09-25T06:41:01.140844Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2016-09-25T06:41:01.144552Z 1 [Note] A temporary password is generated for root@localhost: VhQr7aha4h.X

启动mysql,

➜  support-files ./mysql.server start
Starting MySQL
. SUCCESS!

更改临时密码,

➜  mysql bin/mysqladmin -u root -p password 034039
Enter password:
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.

测试重启,

➜  support-files ./mysql.server restart
Shutting down MySQL
. SUCCESS!
Starting MySQL
. SUCCESS!

测试关闭

➜  support-files ./mysql.server stop
Shutting down MySQL
. SUCCESS!

测试登录

➜  ~ mysql -u root -p034039
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 2
Server version: 5.7.15 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>

查看mysql编码,

mysql> show variables like '%char%' ;
+--------------------------+----------------------------------+
| Variable_name            | Value                            |
+--------------------------+----------------------------------+
| character_set_client     | utf8                             |
| character_set_connection | utf8                             |
| character_set_database   | latin1                           |
| character_set_filesystem | binary                           |
| character_set_results    | utf8                             |
| character_set_server     | latin1                           |
| character_set_system     | utf8                             |
| character_sets_dir       | /usr/local/mysql/share/charsets/ |
+--------------------------+----------------------------------+
8 rows in set (0.01 sec)

修改mysql编码 macOS上安装 MySQL 默认是没有 my.cnf 配置文件的,MySQL 使用默认配置运行。如果需要对 MySQL 进行定制,复制「/usr/local/mysql/support-files/」目录下的一个 cnf 文件到「/etc/」目录下并重命名为 my.cnf,添加如下配置,

[client]
default-character-set=utf8

[mysql]
default-character-set=utf8

[mysqld]
character-set-server=utf8

重启mysql,查看编码方式,

mysql> show variables like '%char%' ;
ERROR 2006 (HY000): MySQL server has gone away
No connection. Trying to reconnect...
Connection id:    2
Current database: *** NONE ***

+--------------------------+----------------------------------+
| Variable_name            | Value                            |
+--------------------------+----------------------------------+
| character_set_client     | utf8                             |
| character_set_connection | utf8                             |
| character_set_database   | utf8                             |
| character_set_filesystem | binary                           |
| character_set_results    | utf8                             |
| character_set_server     | utf8                             |
| character_set_system     | utf8                             |
| character_sets_dir       | /usr/local/mysql/share/charsets/ |
+--------------------------+----------------------------------+
8 rows in set (0.01 sec)

mysql>

======END======

© 著作权归作者所有

上一篇: MySQL binlog
下一篇: goroutine的调度
秋风醉了
粉丝 253
博文 532
码字总数 405755
作品 0
朝阳
程序员
私信 提问
加载中

评论(0)

Mac OSX操作系统安装和配置Zend Server 6教程(1)

作为web开发人员,应该熟悉掌握各种系统下安装和配置web服务器与站点的技术。 随着越来越多的开发人员选择Zend Server服务器,慧都推出了在Mac OSX系统安装和配置Zend Server 6教程,此教程将...

kouxunli1
2013/10/15
180
0
历经11个测试版,苹果 macOS Mojave 正式版发布

苹果今天发布了 macOS Mojave 正式版,Mojave 一共经历了 11 个测试版。Mac 用户可以免费下载和安装 Mojave。下载地址 >>> https://itunes.apple.com/us/app/macos-mojave/id1398502828?mt=1......

局长
2018/09/25
1W
51
OSX malware and exploit collection (~100 files) + links and resources for OSX malware analysis

此文为关于MAC OSX系统的所有攻击脚本和溢出代码的收藏集。附带资源链接和相关讲解文档~mark下 'Tis the season. Here is a nice collection of ~100 Mac OS malware and Word document expl...

Cnlouds
2013/11/26
235
2
MacOS源码安装LuaJIT

今天想在自己的Mac上源码安装LuaJIT, 结果发现各种报错,在此做个笔记,也便以后查阅。 环境 系统版本:macOS Mojave, 10.14.3 XCode: Version 10.1 源码编译LuaJIT 下载源码 解压 编译 安装...

AlgoPeek
2019/02/02
0
0
新版 macOS 默认不包含脚本语言运行时,并将移除 Python 2.7

根据 macOS 下一个主要版本 10.15(macOS Catalina) 的发布说明,从该版本起,macOS 默认不包含脚本语言运行时。 在发布说明中苹果称,为了保持与旧版软件的兼容性,macOS 默认包含了脚本语...

局长
2019/06/07
5.7K
17

没有更多内容

加载失败,请刷新页面

加载更多

maven插件加载类问题

https://www.cnblogs.com/coder-chi/p/11305498.html

Java搬砖工程师
44分钟前
56
0
(免费)霍兰德职业兴趣测试 在线测试霍兰德职业兴趣

霍兰德职业兴趣测试通过对你的个性进项测试评估,并为你关联到具体的职业。霍兰德职业兴趣量表是由美国著名的心理学教授霍兰德编制,具有广泛的应用和深度的职业兴趣理论。霍兰德职业兴趣量表...

蛤蟆丸子
46分钟前
74
0
在Linux中对pthread_create的未定义引用

我从https://computing.llnl.gov/tutorials/pthreads/在网络上获取了以下演示 #include <pthread.h>#include <stdio.h>#define NUM_THREADS 5void *PrintHello(void *threadid){ ......

javail
46分钟前
90
0
CAS原理分析及ABA问题详解

什么是CAS CAS即Compare And Swap的缩写,翻译成中文就是比较并交换,其作用是让CPU比较内存中某个值是否和预期的值相同,如果相同则将这个值更新为新值,不相同则不做更新,也就是CAS是原子...

Onegoleya
48分钟前
67
0
安卓版微信视频播放全屏处理

问题 在安卓版微信里,video在播放的时候,如果在没有做任何处理的情况下,微信会全屏播放你的视频,会严重影响一些例如直播之类的边看视频边交互的H5应用(注:在iOS里可以通过playsinline...

Jack088
58分钟前
73
0

没有更多内容

加载失败,请刷新页面

加载更多

返回顶部
顶部