Appendix B. Configuring MySQL
Now that you have a running MySQL installation, as an administrator, you can make some configuration setting changes and perform some administrative tasks. The first thing to do is set up a schema and privileges to allow web applications to access that schema. Other tasks are to set various MySQL command options for optimal performance.
Running MySQL for the First Time
The first thing to do is to change the password for the root user. The root user is the default administrative user for the database. Even though the name is the same as the operating system root user, this root user is only a MySQL user, and any changes you make to this user are only made within the database. By default, this user has no password, though you can only connect to the database from the same host that the database is running on. Despite this, it is still a good idea to change it so the root user has an actual password. To change the root user's password, start the MySQL command line client:
Then set the user password with the following SQL statements:
mysql> SET PASSWORD FOR root@localhost=PASSWORD('rootpass'); mysql> SET PASSWORD FOR firstname.lastname@example.org=PASSWORD('rootpass'); mysql> SET PASSWORD FOR root@myhost=PASSWORD('rootpass');
Of course, replace the word
rootpass in the previous code with the desired password. The reason for running this three times for the same user but different hosts is because database users are specified with
user@host; in order for the ...
Get Developing Web Applications with Perl, memcached, MySQL® and Apache now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.