ref (unreliable): https://stackoverflow.com/questions/15450091/error-2002-hy000-cant-connect-to-local-mysql-server-through-socket-tmp-mys
- Download dmg from official. Something like https://cdn.mysql.com//Downloads/MySQL-8.3/mysql-8.3.0-macos14-arm64.dmg .
- Run the dmg. You will have cli tools then, now you have:
1~ λ mysql --version2mysql Ver 8.3.0 for macos13.6 on arm64 (Homebrew)brew services start mysqlor something else to start mysql service.
1==> Successfully started `mysql` (label: homebrew.mxcl.mysql)-
mysql_secure_installation -
Next, see the following history:
1~ λ sudo mysql2Password:3ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)4~ λ sudo chown -R _mysql:mysql /usr/local/var/mysql5
6chown: /usr/local/var/mysql: No such file or directory7~ λ sudo mysql.server start8
9Starting MySQL10. ERROR! The server quit without updating PID file (/opt/homebrew/var/mysql/floriandeMacBook-Air.local.pid).11~ λ mysql -u root -p h127.0.0.112
13Enter password:14ERROR 1049 (42000): Unknown database 'h127.0.0.1'15~ λ mysql -u root -p15 collapsed lines
16Enter password:17Welcome to the MySQL monitor. Commands end with ; or \g.18Your MySQL connection id is 1219Server version: 8.3.0 MySQL Community Server - GPL20
21Copyright (c) 2000, 2024, Oracle and/or its affiliates.22
23Oracle is a registered trademark of Oracle Corporation and/or its24affiliates. Other names may be trademarks of their respective25owners.26
27Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.28
29mysql> CREATE USER 'julyfun'@'localhost' IDENTIFIED BY 'guest123';30Query OK, 0 rows affected (0.03 sec)- You can now install, in vscode, the MySql extension by Wejian Chen.
Better not
- brew install mysql / mariadb