diesel_cli 关于 DATABASE_URL 的设置 returns 错误

diesel_cli setup returns error regarding DATABASE_URL

我正在尝试设置 Diesel-CLI 但它总是 returns 关于 DATABASE_URL.

的一些错误

对于这个问题,我们假设:


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://root@127.0.0.1/codeforces

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

For DATABASE_URL=mysql://root:#Abcd1234@127.0.0.1/codeforces

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


我试过谷歌搜索但到目前为止没有结果。我不知道我在哪里犯了错误。

所以我的问题是:
如何解决这个错误?

我的 DATABASE_URL 没有工作,因为我在 url 中使用了保留字符。

来自 RFC 1738 规范:

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

对于那些在将 'localhost' 更改为“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

尝试这样做(对我有用):

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