Creating a MySQL user via the command line
Submitted by Dominic Ryan on Tue, 2007-09-11 22:51.
Now that you have installed your MySQL 5 server on your Windows server, it is time to start getting into the nuts and bolts of it. In this guide we'll show you the steps needed to create a new MySQL user by using the MySQL command line client. In most instances these days you'll be able to use a GUI manager for MySQL such as phpMyAdmin, but in some instances you may need to do it via the command line. Creating a user is a very easy procedure, so lets get into it.
All done. Told you there wasn't much to it!
- Start the MySQL command line client by selecting the MySQL Command Line Client item from your MySQL program group in your start menu.
- The MySQL command line client will prompt you for the root password. Enter it and push enter.
- To create a user simply type in;
CREATE USER 'test'@'localhost' IDENTIFIED BY 'your_password';
- This will create a user called test on localhost with a password of your_password. Simply replace the name and the password with what you want.
- Finally, lets verify that the your user has been created. Type in;
SELECT user FROM mysql.user;
- This will list all the users on your server, and you';ll see our test user listed.
- Refer to figure 1 below to see an example of the MySQL command line output you would expect to see by running these commands.