SQLSTATE[HY000] [1698] Access denied for user 'root'@'localhost'

前端 未结 10 581
灰色年华
灰色年华 2020-12-04 12:49

I just installed Ubuntu 16.04 and installed web server on it. Everything works well, but I cannot access database. Even if I create new user and grant all privileges, I can\

10条回答
  •  一整个雨季
    2020-12-04 13:36

    Just Create New User for MySQL do not use root. there is a problem its security issue

    sudo mysql -p -u root
    

    Login into MySQL or MariaDB with root privileges

    CREATE USER 'troy121'@'%' IDENTIFIED BY 'mypassword123';
    

    login and create a new user

    GRANT ALL PRIVILEGES ON *.* TO 'magento121121'@'%' WITH GRANT OPTION;
    

    and grant privileges to access "." and "@" "%" any location not just only 'localhost'

    exit;
    

    if you want to see your privilege table SHOW GRANTS; & Enjoy.

提交回复
热议问题