gpt4 book ai didi

mysql - diesel_cli设置返回有关DATABASE_URL的错误

转载 作者:行者123 更新时间:2023-12-03 11:39:32 27 4
gpt4 key购买 nike

我正在尝试设置Diesel-CLI,但始终会返回有关 DATABASE_URL 的错误。

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

  • user = root
  • password =#Abcd1234
  • host =本地主机
  • database = codeforces
  • mysql服务器套接字=/var/lib/mysql/mysql.sock/

  • 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)



    我已经尝试使用Google搜索,但到目前为止没有任何结果。我不知道我在哪里犯错。

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

    最佳答案

    我的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';

    关于mysql - diesel_cli设置返回有关DATABASE_URL的错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61835634/

    27 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com