What is the default root pasword for MySQL 5.7

前端 未结 13 1204
梦谈多话
梦谈多话 2020-12-22 16:55

Cannot login to MySQL database after fresh install with root ID and empty/no password like other older MySQL versions do

13条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-22 17:59

    It seems things were designed to avoid developers to se the root user, a better solution would be:

    sudo mysql -u root
    

    Then create a normal user, set a password, then use that user to work.

    create user 'user'@'localhost' identified by 'user1234';
    grant all on your_database.* to 'user'@'localhost';
    select host, user from mysql.user;
    

    Then try to access:

    mysql -u user -p
    

    Boom!

提交回复
热议问题