MySQL Admin Tasks
More Information
Setting Password for MySQL Root User
Execute the following commands at a shell prompt:
/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h `hostname` password 'new-password'
Creating User Accounts
MySQL 5.0 and later only, in prior versions just add grants and passwords instead.
Execute the following commands at the mysql prompt:
CREATE USER user;
Adding Grants
Execute the following commands at the mysql prompt:
GRANT ALL ON mydb.* TO joebob@localhost;
GRANT ALL ON mydb.* TO joebob@"%";
Setting Password for Other Users
Execute the following commands at the mysql prompt:
SET PASSWORD FOR joebob@localhost=PASSWORD('nochange');
SET PASSWORD FOR joebob@"%"=PASSWORD('nochange');
Create a Database
Execute the following commands at the mysql prompt:
CREATE DATABASE mydb;
USE mydb;