Linux 초기 setting/MySQL

맥 mysql 설치 및 시작

에혀 2021. 5. 14.

[sudo] brew services [list]:
    List all managed services for the current user (or root).

[sudo] brew services run (formula|--all):
    Run the service formula without registering to launch at login (or boot).

[sudo] brew services start (formula|--all):
    Start the service formula immediately and register it to launch at login
(or boot).

[sudo] brew services stop (formula|--all):
    Stop the service formula immediately and unregister it from launching at
login (or boot).

[sudo] brew services restart (formula|--all):
    Stop (if necessary) and start the service formula immediately and register
it to launch at login (or boot).

[sudo] brew services cleanup:
    Remove all unused services.이 사소한 게 잘 안돼서, 2시간은 잡아먹었다. 왜 됐는지 모르겠으나, 여러차례 삭제, 재설치 등 삽질하다가 그냥 됐다.

 

 

✘ kang@bigsur8700k  /usr/local/etc  mysql -u kang
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
 ✘ kang@bigsur8700k  /usr/local/etc  brew reinstall mysql
==> Downloading https://ghcr.io/v2/homebrew/core/mysql/manifests/8.0.23_1
Already downloaded: /Users/kang/Library/Caches/Homebrew/downloads/08a0f50a78fd35e0c324099f95af1529b69e2f82a0d9793ff997ea9b53093aa3--mysql-8.0.23_1.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/mysql/blobs/sha256:9e9e4b5bfcad47adfbf7f2af7ebf2c2cc
Already downloaded: /Users/kang/Library/Caches/Homebrew/downloads/8fa7b6936a8e6a3c8d11163c32e12ddbeae5fb94b40342723044fc3c8aa526ba--mysql--8.0.23_1.big_sur.bottle.tar.gz
==> Reinstalling mysql
==> Pouring mysql--8.0.23_1.big_sur.bottle.tar.gz
==> Caveats
We've installed your MySQL database without a root password. To secure it run:
    mysql_secure_installation

MySQL is configured to only allow connections from localhost by default

To connect run:
    mysql -uroot

 

( root   암호 설정한 후엔 , mysql -uroot -p  로 접속! ) 패스워드 필요.

To have launchd start mysql now and restart at login:
  brew services start mysql
Or, if you don't want/need a background service you can just run:
  mysql.server start
==> Summary
🍺  /usr/local/Cellar/mysql/8.0.23_1: 298 files, 297.7MB
 kang@bigsur8700k  /usr/local/etc  mysql.server start
Starting MySQL
 SUCCESS!
 kang@bigsur8700k  /usr/local/etc  2021-05-13T15:52:30.6NZ mysqld_safe A mysqld process already exists
mysql -uroot
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.23 Homebrew

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

mysql> exit
Bye
 kang@bigsur8700k  /usr/local/etc  brew services mysql stop
Error: No available formula with the name "stop".
 ✘ kang@bigsur8700k  /usr/local/etc  brew services stop mysql
Stopping `mysql`... (might take a while)
==> Successfully stopped `mysql` (label: homebrew.mxcl.mysql)
 kang@bigsur8700k  /usr/local/etc  mysql.server start
Starting MySQL
. SUCCESS!
 kang@bigsur8700k  /usr/local/etc  

Usage: brew services [subcommand]

 


Manage background services with macOS' launchctl(1) daemon manager.

If sudo is passed, operate on /Library/LaunchDaemons (started at boot).
Otherwise, operate on ~/Library/LaunchAgents (started at login).

[sudo] brew services [list]:
    List all managed services for the current user (or root).

[sudo] brew services run (formula|--all):
    Run the service formula without registering to launch at login (or boot).

[sudo] brew services start (formula|--all):
    Start the service formula immediately and register it to launch at login
(or boot).

[sudo] brew services stop (formula|--all):
    Stop the service formula immediately and unregister it from launching at
login (or boot).

[sudo] brew services restart (formula|--all):
    Stop (if necessary) and start the service formula immediately and register
it to launch at login (or boot).

[sudo] brew services cleanup:
    Remove all unused services.

      --all                        Run subcommand on all services.
  -d, --debug                      Display any debugging information.
  -q, --quiet                      Make some output more quiet.
  -v, --verbose                    Make some output more verbose.
  -h, --help                       Show this message.


 ✘ kang@bigsur8700k  /usr/local/etc  mysql_secure_installation

Securing the MySQL server deployment.

Connecting to MySQL using a blank password.

VALIDATE PASSWORD COMPONENT can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD component?

Press y|Y for Yes, any other key for No: n
Please set the password for root here.

New password:

Re-enter new password:
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
environment.

Remove anonymous users? (Press y|Y for Yes, any other key for No) : n

 ... skipping.


Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network.

Disallow root login remotely? (Press y|Y for Yes, any other key for No) : n

 ... skipping.
By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment.


Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y
 - Dropping test database...
Success.

 - Removing privileges on test database...
Success.

Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.

Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
Success.

All done!
 kang@bigsur8700k  /usr/local/etc  mysql -uroot
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
 ✘ kang@bigsur8700k  /usr/local/etc  mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 11
Server version: 8.0.23 Homebrew

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

mysql>

댓글