Dipanshu Kumar Suman
Dipanshu Kumar Suman

Reputation: 373

diesel_cli setup returns error regarding DATABASE_URL

I am trying to setup Diesel-CLI but it always returns some error regarding DATABASE_URL.

For this question, Let's assume:


For DATABASE_URL=mysql://root:#Abcd1234@localhost/codeforces  
and DATABASE_URL=mysql://root:#Abcd1234@localhost/codeforces.sql?socket=(/var/lib/mysql/mysql.sock)

Error: Unknown MySQL server host 'root' (-2)

For DATABASE_URL=mysql://root@localhost/codeforces  
and DATABASE_URL=mysql://root@localhost/codeforces?socket=(/var/lib/mysql/mysql.sock)

Error: Can't connect to local MySQL server through socket '/run/mysql/mysql.sock' (2)

For DATABASE_URL=mysql://[email protected]/codeforces

Error: Access denied for user 'root'@'localhost' (using password: NO)

For DATABASE_URL=mysql://root:#[email protected]/codeforces

Error: Unknown MySQL server host 'root' (-2)


I have tried googling it but no results so far. I don't know where i am making the mistake.

So my question is:
How to reslove this error?

Upvotes: 2

Views: 898

Answers (1)

Dipanshu Kumar Suman
Dipanshu Kumar Suman

Reputation: 373

My DATABASE_URL was not working because i was using reserved characters in the url.

From RFC 1738 specification:

Only alphanumerics, the special characters "$-_.+!*'(),", and reserved characters used for their reserved purposes may be used unencoded within a URL.

For those who are getting this error on changing 'localhost' to '127.0.0.1' :

Error: Plugin caching_sha2_password could not be loaded: /usr//usr/lib64/mysql/plugin//caching_sha2_password.so: cannot open shared object file: No such file or directory

Try doing this(It worked for me):

mysql>ALTER USER 'yourusername'@'localhost' IDENTIFIED WITH mysql_native_password BY 'yourpassword';

Upvotes: 1

Related Questions