ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2)
사용자와 bind
1 2
[mysqld] bind-address = 0.0.0.0
mysql> mysql> create user ‘root‘@’%’ identified by ‘rkdxo!0615’; Query OK, 0 rows affected (0.36 sec)
mysql> grant privileges on . to ‘root‘@’%’; ERROR 1149 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use mysql> grant all privileges on . to ‘root‘@’%’; Query OK, 0 rows affected (0.11 sec)
$ pyenv doctor Cloning /home/USER/.pyenv/plugins/pyenv-doctor/bin/..... Installing python-pyenv-doctor... Installed python-pyenv-doctor to /tmp/pyenv-doctor.20250327094025.5063/prefix Congratulations! You are ready to build pythons!
기타
시스템에 빌드 도구가 설치되지 않으면 doctor 명령을 실행하면 다양한 에러를 낸다.
1 2 3 4 5 6 7
$ pyenv doctor ... ... configure: error: GNU readline is not installed. Problem(s) detected while checking system.
See https://github.com/pyenv/pyenv/wiki/Common-build-problems for known solutions.
$ systemctl status mariadb ● mariadb.service - MariaDB 11.3.2 database server Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled) Drop-In: /etc/systemd/system/mariadb.service.d └─migrated-from-my.cnf-settings.conf Active: active (running) since Tue 2024-03-05 06:32:22 KST; 7min ago Docs: man:mariadbd(8) https://mariadb.com/kb/en/library/systemd/
MariaDB 보안 설정하기
설치후에 MariaDB 시스템 초기화와 보안 설정을 진행해야 한다.
7개 질문이 나오는데 unix_socket 은 n 이고 나머지는 기본 값으로 진행한다.
단, root 패스워드는 잊어버리지 않아야 한다.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
$ sudo mysql_secure_installation
Enter current password for root (enter for none):
Switch to unix_socket authentication [Y/n] n
Change the root password? [Y/n] Y
Remove anonymous users? [Y/n] Y
Disallow root login remotely? [Y/n] Y
Remove test database and access to it? [Y/n] Y
Reload privilege tables now? [Y/n] Y
이제 root 계정으로 명령행으로 접속해 보자
1 2 3 4 5 6 7 8 9 10 11
~$ mariadb -u root -p Enter password: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 40 Server version: 11.3.2-MariaDB-1:11.3.2+maria~ubu2204 mariadb.org binary distribution
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h'forhelp. Type '\c' to clear the current input statement.
MariaDB [(none)]>
현재 11버전까지 mysql 클라이언트를 사용하지만 향후 deprecated 될 예정으로
mariadb 클라이언트 사용을 권장한다.
Option file 설정
설정 파일은 유닉스 계열은 my.cnf (or mariadb.cnf) 이고 윈도우 계열은 my.ini 이다.