How to create mysql user on MySQL 8 with native password

sachin
edited June 2022 in database

Normal created user is unable to access database

Tagged:

Answers

  • sachin
    edited June 2022

    Normally we create user using following:

    CREATE USER 'user'@'localhost' IDENTIFIED BY 'password';
    GRANT ALL PRIVILEGES ON *.* TO 'user'@'localhost';
    FLUSH PRIVILEGES;
    EXIT;
    

    To create user with native password:

    CREATE USER 'user'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
    GRANT ALL PRIVILEGES ON *.* TO 'user'@'localhost';
    FLUSH PRIVILEGES;
    EXIT;
    

    Or for existing user execute following:

    ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
    EXIT;
    

    ** If the user needs to write files into the file system

    GRANT FILE ON *.* TO 'user'@'localhost';
    FLUSH PRIVILEGES;
    EXIT;
    
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!