Follow these steps to create new user for MySQL in command line. Note this instruction assume that you have already setup MySQL.
1. Open a terminal and login to MySQL as root
mysql --user="root" --password="your_root_password"
2. Create new user and password with following command
CREATE USER 'new_username'@'localhost'
IDENTIFIED BY 'password_for_new_user';
3. Assign privileges to the new user
GRANT ALL ON *.* TO 'new_username'@'localhost';
4. Exit MySQL interface
exit
Notes:
The above instructions will create a new user account on "localhost" and grant the user all privileges. While this is safe for my development environment, you would obviously want to grant only the necessary permissions in a production environment.
For more information including the MySQL manual references, visit here.
0 comments:
Post a Comment