0

There is a problem with mysql connection.

When I use msnoise db init, there are some questions.

What database technology do you want to use?
 [1] sqlite
 [2] mysql
Choice: 2
Server: [localhost] :
Database: [msnoise]: 
Username: [msnoise]: 
Password : 
Table prefix: []:

And in the MySQL Workbench, login name is msnoise and edited 'Limit to Hosts Matching' as '%'.

I answered server[localhost] as 127.0.0.1, localhost, server name etc, Database as msnoise, username as msnoise, table prefix as blank but there is an error as below.

sqlalchemy.exc.OperationalError: (pymysql.err.OperationalError) (2003, "Can't connect to MySQL server on '127.0.0.1' ([Errno 111] Connection refused)")
(Background on this error at: https://sqlalche.me/e/14/e3q8)

I cannot find what the problem is.

Also, when I write 'mysql' on linux, the error as below occurs.

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

I saw my.cnf but nothing was written related to mysql.sock and cannot find the file location.

Could you please let me know the solutions?

Joe
  • 51
  • 7
  • You'll need to start the MySQL server before using it in terminal. The error 2002 indicates it is not running. You can start using `service mysqld start`. For more info: https://stackoverflow.com/questions/5376427/cant-connect-to-local-mysql-server-through-socket-var-mysql-mysql-sock-38?rq=1 – Jishan Shaikh Jan 12 '22 at 08:50
  • You can also verify your running services as `sudo service --status-all` – Jishan Shaikh Jan 12 '22 at 08:52
  • Thanks for your help. Yes it works in local (my desktop) but not in the server because I do not know the password of 'root' or 'sudo'. But I could find the way how to solve it Thanks! :) – Joe Jan 13 '22 at 08:44

0 Answers0