回答編集履歴

1

MySQLのインストール手順を追加

2019/09/19 11:34

投稿

nandymak
nandymak

スコア799

test CHANGED
@@ -43,3 +43,235 @@
43
43
  $ echo $PATH
44
44
 
45
45
  ```
46
+
47
+ ---
48
+
49
+
50
+
51
+ 2019/09/19 20:00追記
52
+
53
+ ## MySQL@5.6をHomebrewでインストールしてみました。
54
+
55
+ ### 現状の確認
56
+
57
+ ```bash
58
+
59
+ nandymak:~ nandymak$ brew uninstall mariadb
60
+
61
+ Error: No such keg: /usr/local/Cellar/mariadb
62
+
63
+ nandymak:~ nandymak$ brew list
64
+
65
+ cmake graphviz libgcrypt libxmlsec1 p11-kit
66
+
67
+ fontconfig gts libgpg-error mpfr pcre
68
+
69
+ freetype heroku libidn2 netpbm python
70
+
71
+ gcc heroku-node libmpc nettle r
72
+
73
+ gd icu4c libpng node readline
74
+
75
+ gdbm isl libtasn1 nodebrew sqlite
76
+
77
+ gettext jasper libtiff oath-toolkit unbound
78
+
79
+ glib jpeg libtool openblas webp
80
+
81
+ gmp libevent libunistring openssl wget
82
+
83
+ gnutls libffi libxml2 openssl@1.1 xz
84
+
85
+ nandymak:~ nandymak$
86
+
87
+ ```
88
+
89
+ ### MySQL5.6をインストール
90
+
91
+ ```bash
92
+
93
+ nandymak:~ nandymak$ brew search mysql@5.6
94
+
95
+ ==> Formulae
96
+
97
+ mysql@5.6
98
+
99
+ nandymak:~ nandymak$ brew install mysql@5.6
100
+
101
+ Updating Homebrew...
102
+
103
+ ==> Auto-updated Homebrew!
104
+
105
+ Updated 1 tap (homebrew/core).
106
+
107
+ ==> Updated Formulae
108
+
109
+ etcd pilosa teleport
110
+
111
+
112
+
113
+ ==> Downloading https://homebrew.bintray.com/bottles/mysql@5.6-5.6.43.mojave.bottle.1.tar.gz
114
+
115
+ ==> Downloading from https://akamai.bintray.com/8d/8d276249e7adf93c716505d9959c690db014693480
116
+
117
+ ######################################################################## 100.0%
118
+
119
+ ==> Pouring mysql@5.6-5.6.43.mojave.bottle.1.tar.gz
120
+
121
+ ==> Caveats
122
+
123
+ A "/etc/my.cnf" from another install may interfere with a Homebrew-built
124
+
125
+ server starting up correctly.
126
+
127
+
128
+
129
+ MySQL is configured to only allow connections from localhost by default
130
+
131
+
132
+
133
+ To connect:
134
+
135
+ mysql -uroot
136
+
137
+ (途中省略)
138
+
139
+ To have launchd start mysql@5.6 now and restart at login:
140
+
141
+ brew services start mysql@5.6
142
+
143
+ Or, if you don't want/need a background service you can just run:
144
+
145
+ /usr/local/opt/mysql@5.6/bin/mysql.server start
146
+
147
+ ==> Summary
148
+
149
+ ???? /usr/local/Cellar/mysql@5.6/5.6.43: 341 files, 153.6MB
150
+
151
+ nandymak:~ nandymak$
152
+
153
+ ```
154
+
155
+
156
+
157
+ ### 動作を確認
158
+
159
+ ```bash
160
+
161
+ nandymak:~ nandymak$ mysql -uroot
162
+
163
+ -bash: mysql: command not found
164
+
165
+ nandymak:~ nandymak$ which mysql
166
+
167
+ nandymak:~ nandymak$ type mysql
168
+
169
+ -bash: type: mysql: not found
170
+
171
+ nandymak:~ nandymak$
172
+
173
+ ```
174
+
175
+ ### PATHを通す
176
+
177
+ ```bash
178
+
179
+ nandymak:~ nandymak$ echo 'export PATH="/usr/local/opt/mysql@5.6/bin:$PATH"' >> ~/.bash_profile
180
+
181
+ nandymak:~ nandymak$ source ~/.bash_profile
182
+
183
+ nandymak:~ nandymak$ type
184
+
185
+ nandymak:~ nandymak$ mysql
186
+
187
+ ERROR 1045 (28000): Access denied for user 'nandymak'@'localhost' (using password: NO)
188
+
189
+ nandymak:~ nandymak$ mysql --version
190
+
191
+ mysql Ver 14.14 Distrib 5.6.43, for osx10.14 (x86_64) using EditLine wrapper
192
+
193
+ ```
194
+
195
+ ### 起動する
196
+
197
+ ```
198
+
199
+ nandymak:~ nandymak$ brew services start mysql@5.6
200
+
201
+ ==> Successfully started `mysql@5.6` (label: homebrew.mxcl.mysql@5.6)
202
+
203
+ ```
204
+
205
+ ### ログインする
206
+
207
+ ```bash
208
+
209
+ nandymak:~ nandymak$ mysql -uroot -pXXXXXXXX
210
+
211
+ Warning: Using a password on the command line interface can be insecure.
212
+
213
+ Welcome to the MySQL monitor. Commands end with ; or \g.
214
+
215
+ Your MySQL connection id is 27
216
+
217
+ Server version: 5.5.5-10.4.6-MariaDB Homebrew
218
+
219
+
220
+
221
+ Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
222
+
223
+
224
+
225
+ Oracle is a registered trademark of Oracle Corporation and/or its
226
+
227
+ affiliates. Other names may be trademarks of their respective
228
+
229
+ owners.
230
+
231
+
232
+
233
+ Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
234
+
235
+
236
+
237
+ mysql> quit
238
+
239
+ Bye
240
+
241
+ nandymak:~ nandymak$
242
+
243
+ ```
244
+
245
+
246
+
247
+ ### my.cnfを確認する。
248
+
249
+ ```bash
250
+
251
+ nandymak:etc nandymak$ cat /usr/local/etc/my.cnf
252
+
253
+ #
254
+
255
+ # This group is read both both by the client and the server
256
+
257
+ # use it for options that affect everything
258
+
259
+ #
260
+
261
+ [client-server]
262
+
263
+
264
+
265
+ #
266
+
267
+ # include all files from the config directory
268
+
269
+ #
270
+
271
+ !includedir /usr/local/etc/my.cnf.d
272
+
273
+
274
+
275
+ nandymak:etc nandymak$
276
+
277
+ ```