Access denied for user 'root'@'localhost' (using password: YES) after new installation on Ubuntu

前端 未结 8 916
一个人的身影
一个人的身影 2020-12-04 06:09

Today I did a login as root into Ubuntu 14.04.1 LTS ll

and then apt-get install mariadb-server (without sudo but as root).

With mySQL -h l

8条回答
  •  一个人的身影
    2020-12-04 06:27

    Try the command

    sudo mysql_secure_installation
    

    press enter and assign a new password for root in mysql/mariadb.

    If you get an error like

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

    enable the service with

    service mysql start
    

    now if you re-enter with

    mysql -u root -p
    

    if you follow the problem enter with sudo su and mysql -u root -p now apply permissions to root

    GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY '';

    this fixed my problem in MariaDB.

    Good luck

提交回复
热议问题