Chapter 27. Post-installation Setup and Testing

Table of Contents

Windows Post-installation Procedures
Unix Post-installation Procedures
Problems Running mysql_install_db
Starting and Stopping MySQL Automatically
Starting and Troubleshooting the MySQL Server

There are some issues you should address after installing MySQL. For example, on Unix, you should create the MySQL grant tables. On all platforms, an important security concern is that the initial accounts in the grant tables have no passwords. You should assign passwords to prevent unauthorized access to the MySQL server.

The following sections describe post-installation procedures for Windows systems and for Unix systems.

Windows Post-installation Procedures

On Windows, the grant tables do not have to be created. MySQL Windows distributions include the grant tables already set up in the mysql database under the data directory. However, you should assign passwords to the accounts.

The default privileges on Windows give all local users full privileges to all databases without specifying a password. To make MySQL more secure, you should set a password for all users and remove the row in the mysql.user table that has Host="localhost" and User="".

You should also add a password for the root user. The following example starts by removing the anonymous user that has all privileges, then sets a root user password:

C:\> C:\mysql\bin\mysql mysql
mysql> DELETE FROM user WHERE Host='localhost' AND User='';
mysql> FLUSH PRIVILEGES;
mysql> QUIT
C:\> C:\mysql\bin\mysqladmin -u root password your_password

After you've set the password, if you want to shut down the mysqld server, you can do so using this command:

C:\> mysqladmin --user=root --password=your_password shutdown

If you are using a server from a very old version of MySQL, the mysqladmin command to set the password will fail with an error: parse error near 'SET password'. The solution to this problem is to upgrade to a newer version of MySQL.

With the current MySQL versions you can easily add new users and change privileges with GRANT and REVOKE commands. See GRANT.