MySQL User Names and Passwords on Linux

In the next section, I will describe the whole process of creating and managing users in some depth. The next few paragraphs, however, will serve as a quick start for Linux users.

As mentioned in the last section, the first thing you need to do on Linux is run the mysql_install_db script, which is usually placed in the /usr/bin directory. It doesn't hurt (or help) to run this script more than once.  You will find most of the scripts you need in the /usr/bin directory.

Now you need to set the password for root:

mysqladmin -u root password new_password

Then sign on to the mysql monitor by typing the following:

mysql mysql --user=root --password=mypassword

Add at least one user, granting them super user privilege:

mysql> GRANT ALL PRIVILEGES ON *.* TO ccalvert@localhost

To see if things are working, type the following at the command prompt:

mysqlshow -p

The -p at the end of the command asks the system to prompt you for a password. What you will get back is a list of available databases on the system. A virgin system would show test and mysql as existing databases. More details about this process are explained in the help for MySQL in section 4.3.4 Setting Up the Initial MySQL Privileges.