์ผ๋จ brew๋ก mariadb๋ฅผ ์ค์นํ๋ค.
mysql์ด ์ผ์ ธ์์ผ๋ฉด mariadb๋ฅผ ์คํํ ์ ์๋ ๋ฏ. ์์ ์ค์ ์์ mysql์ ์ข ๋ฃํด์ฃผ๊ณ ์๋ฒ๋ฅผ ์ฌ์ฉํ๋ค.
brew services start mariadb@10.11
mariadb ์คํ. 10.11์ ๋ฒ์ ๋ช ์ด๋ค.
brew services list
์คํ ์ค์ธ db ๋ชฉ๋ก์ ํ์ธํ ์ ์๋ค.
Name Status User File
h2 none
mariadb@10.11 started ์ ์ ์ด๋ฆ ~/Library/LaunchAgents/homebrew.mxcl.mariadb@10.11.plist
mysql none
status๊ฐ started๋ก ๋์ด ์์ผ๋ฉด ์คํ์ ์ฑ๊ณตํ ๊ฒ
๐์ค๋ฅ ํด๊ฒฐ
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
mysql -u root -p
mariadb์ mysql์ ๋ช ๋ น์ด๊ฐ ๋์ผํด์ ์์ ๊ฐ์ ๋ช ๋ น์ด๋ก mariadb์ ์ ์ํ ์ ์๋ค.
๊ทธ๋ฐ๋ฐ ์ฌ๊ธฐ์ mysql.sock ํ์ผ์ ์ค๋ฅ๊ฐ ์๋ ๊ฒฝ์ฐ ์ ์์ด ๋ถ๊ฐํ ์ ์๋ค.
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
/tmp ํ์ผ์ ๊ฐ์ sock ํ์ผ์ด ์๋์ง ๋ค์ ธ๋ณธ๋ค.
> cd tmp
> /tmp
> ls
2ACBB14C-820D-40A9-8581-31847B1B2110 CBDF6E41-F753-4FA7-A667-3C0491807971
2B19E225-B547-4CA0-AB0F-173AAE6B4338 ExmanProcessMutex
2FCD66F0-F802-496E-9253-FD3887B78BD8 F6558A65-F740-40AA-B423-CBB7B59D7489
711EE556-F58D-474E-897B-B01F7E08E7E6_IN adobegc.log
711EE556-F58D-474E-897B-B01F7E08E7E6_OUT com.adobe.AdobeIPCBroker.ctrl-์ ์ ์ด๋ฆ
7FC4BE13-E600-4A53-810A-280AB9E72700_IN com.apple.launchd.TfGsCBQSwI
7FC4BE13-E600-4A53-810A-280AB9E72700_OUT foo.err
8502BD08-FB5C-452A-99C1-0A1AAAA80AAC lilo.66704
AlTest1.err mysql.sock
AlTest1.out powerlog
CBAE382C-EADF-4F5B-A9D4-C60B42F75DA0
mysql.sock ํ์ผ์ด ์กด์ฌํ๋๋ฐ๋ ์ ์์ด ์ ๋๊ณ ์๋ค.
์ด ํ์ผ์ ์ญ์ ํด์ค๋ค.
sudo rm mysql.sock
> ls
2ACBB14C-820D-40A9-8581-31847B1B2110 CBAE382C-EADF-4F5B-A9D4-C60B42F75DA0
2B19E225-B547-4CA0-AB0F-173AAE6B4338 CBDF6E41-F753-4FA7-A667-3C0491807971
2FCD66F0-F802-496E-9253-FD3887B78BD8 ExmanProcessMutex
711EE556-F58D-474E-897B-B01F7E08E7E6_IN F6558A65-F740-40AA-B423-CBB7B59D7489
711EE556-F58D-474E-897B-B01F7E08E7E6_OUT adobegc.log
7FC4BE13-E600-4A53-810A-280AB9E72700_IN com.adobe.AdobeIPCBroker.ctrl-์ ์ ์ด๋ฆ
7FC4BE13-E600-4A53-810A-280AB9E72700_OUT com.apple.launchd.TfGsCBQSwI
8502BD08-FB5C-452A-99C1-0A1AAAA80AAC foo.err
AlTest1.err lilo.66704
AlTest1.out powerlog
mysql.sock์ด ์ญ์ ๋ ๊ฒ์ ํ์ธํ ์ ์๋ค.
๋ค์ ์ ์ํด๋ณธ๋ค.
sudo mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 7
Server version: 5.5.5-10.11.7-MariaDB Homebrew
Copyright (c) 2000, 2024, Oracle and/or its affiliates.
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.
์ฑ๊ณต
๐root ๊ณ์ ์ ๋น๋ฐ๋ฒํธ ์ค์ ํ๊ธฐ
mysql> show databases
DB๋ฅผ ํ์ธํ๋ ๋ช ๋ น์ด
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
| test |
+--------------------+
5 rows in set (0.01 sec)
use mysql;
mysql DB๋ฅผ ์ฌ์ฉํ๊ฒ ๋ค.
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> select host, user, password from user;
+--------------------------------+-------------+----------+
| Host | User | Password |
+--------------------------------+-------------+----------+
| localhost | mariadb.sys | |
| localhost | root | invalid |
| localhost | ์ ์ ์ด๋ฆ | invalid |
| | PUBLIC | |
| localhost | | |
| ์ ์ ์ด๋ฆ-ui-macbookpro.local | | |
+--------------------------------+-------------+----------+
6 rows in set (0.00 sec)
root์ ๋น๋ฐ๋ฒํธ๋ฅผ ์์ ํด์ค๋ค.
set password for 'root'@'localhost' = password('์ฌ์ฉํ ๋น๋ฐ๋ฒํธ');
๐mariaDB ํฌํธ ๋ณ๊ฒฝํ๊ธฐ
mysql๊ณผ mariaDB๋ ๋ ๋ค ๊ธฐ๋ณธ ํฌํธ๊ฐ 3306์ด๋ค.
๋ฐ๋ผ์ mariaDB์ ํฌํธ๋ฅผ 3307๋ก ๋ณ๊ฒฝํด์ค๋ค.
brew๋ก ์ค์นํ๋ฉด my.cnf(์ค์ ํ์ผ) ๊ฒฝ๋ก๋ /opt/homebrew/etc/my.cnf
sudo vi /opt/homebrew/etc/my.cnf
6 rows in set (0.00 sec)
#
# This group is read both by the client and the server
# use it for options that affect everything
#
[client-server]
#
# include *.cnf from the config directory
#
!includedir /opt/homebrew/etc/my.cnf.d
port=3307
์์ ๊ฐ์ด port=3307์ ์ถ๊ฐํด์ค๋ค.
:wq
์ ์ฅํ๊ณ ๋์จ๋ค.
brew services restart mariadb@10.11
๋งฅ ์ฌ๋ถํ ํ ์๋ฒ๋ฅผ ์ฌ์์ํ๋ค.
sudo lsof -PiTCP -sTCP:LISTEN
์ฌ์ฉ ์ค์ธ ์์ผ์ ํ์ธํ๋ ๋ช ๋ น์ด์ด๋ค.
mariadbd 9923 ์ ์ ์ด๋ฆ 21u IPv6 0xcda8cbe584ed7515 0t0 TCP *:3307 (LISTEN)
mariadbd 9923 ์ ์ ์ด๋ฆ 22u IPv4 0xcda8cbe0b6f5a22d 0t0 TCP *:3307 (LISTEN)
๋ณ๊ฒฝํด์ค 3307์์ ์ ์คํ๋๊ณ ์๋ ๊ฒ์ ํ์ธํ ์ ์๋ค.
๐MySQL Workbench์์ mariadb ์ฌ์ฉํ๊ธฐ
+๋ฅผ ๋๋ฌ Connection์ ์ถ๊ฐํ๋ค.
+--------------------------------+-------------+----------+
| Host | User | Password |
+--------------------------------+-------------+----------+
| localhost | mariadb.sys | |
| localhost | root | invalid |
| localhost | ์ ์ ์ด๋ฆ | invalid |
| | PUBLIC | |
| localhost | | |
| ์ ์ ์ด๋ฆ-ui-macbookpro.local | | |
+--------------------------------+-------------+----------+
6 rows in set (0.00 sec)
์๊น database์์ host๋ localhost, user์ด๋ฆ์ root์ธ ๊ฒ์ ํ์ธํ๋ค. ์ ๋ฃ์ด์ค๋ค.
3307๋ก ํฌํธ๋ฅผ ๋ณ๊ฒฝํ์ผ๋ Port:3307๋ก ๋ณ๊ฒฝํด์ค๋ค.
๋น๋ฐ๋ฒํธ๋ฅผ ์ค์ ํ๋ค๋ฉด store in keychain์ ๋๋ฌ ์ค์ ํด์ค๋ค.
Warning์ด ๋จ๋๋ฐ ์ด์ ๋ ์ ๋ชจ๋ฅด๊ฒ ์...
์๋ฌดํผ Test Conncetion ํ Fail์ด ์๋๋ฉด ์ ์ ๊ฐ๋ฅํ๋ค๋ ๊ฒ.
์ ์ฐ๊ฒฐ๋ ๊ฒ์ ํ์ธํ ์ ์๋ค.
๐MySQL Workbench์์ ์ ์ ์ค๋ฅ
ํฌํธ๊ฐ ๋ค๋ฅด๋๋ผ๋ mysql์ด ์ผ์ ธ์์ผ๋ฉด mariadb์ ์ ์ํ ์ ์๊ณ , mariadb๊ฐ ์ผ์ ธ ์์ผ๋ฉด mysql์ ์ ์ํ ์ ์๋ค.
๋ฐ๋ผ์ ์ฌ์ฉํ ๋ ๊ฐ๊ฐ DB๋ฅผ ์ข ๋ฃ์์ผ์ค๋ค.
์ด๋ `brew services stop mysql` ๋ช ๋ น์ด๋ฅผ ์ฌ์ฉํ๋๋ผ๋ mysql์ด ๊บผ์ง์ง ์๋ ๊ฒฝ์ฐ๊ฐ ์๋๋ฐ, ์์์ ์ธ๊ธํ๋ ๊ฒ๊ณผ ๊ฐ์ด ์ค์ ์ ๋ค์ด๊ฐ์ ๊บผ์ฃผ๋ฉด ํด๊ฒฐํ ์ ์๋ค.
mariadb๋ `brew services stop mariadb@10.11` ๋ช ๋ น์ด๊ฐ ์ ๋จนํ๋ฏ๋ก ๋ง๋ฆฌ์ DB๋ฅผ ์ข ๋ฃ ํ mysql์ ์ฌ์ฉํ๋ฉด ๋๋ค.