Q&A

Q1:I have forgotten the root password. What should I do?
A1: If you forget the root password, you'll need to change it to something you know. Shut down mysqld. On Linux you may need to run
# ps -ax | grep mysql
								

to find out the process ID of the mysqld_safe process. You should see something like this:

221  ??  S      0:00.09 sh /usr/local/bin/mysqld_safe
501  ??  S      0:00.30 /usr/local/libexec/mysqld
512 std  R+     0:00.01 grep mysql

The processes to kill in this example are first 221 (mysqld_safe) and 501 (mysqld); there may be one or more instances of mysqld, although only one is shown here. You will probably have to do the somewhat drastic -9 kill, so make sure that no other database users are on the system. (Having open tables at this time can cause ...

Get Sams Teach Yourself MySQL in 21 Days, Second Edition 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.