Create a MySQL User
suggest changeTo create a user:
Step 1: Log in to MySQL as root.
$ mysql -u root -p
Step 2: At the mysql prompt, create the account. It has no privileges yet:
mysql> CREATE USER 'my_new_user'@'localhost' IDENTIFIED BY 'test_password';
Step 3: Grant privileges on one database. Do not put IDENTIFIED BY on GRANT; that clause was removed in MySQL 8.0, and on older servers it would change the password already set above.
mysql> GRANT ALL PRIVILEGES ON my_db.* TO 'my_new_user'@'localhost';
ALL PRIVILEGES here is only on my_db, not global, and it does not include GRANT OPTION.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents