plainblack.com
Username Password
search
Bookmark and Share
Subscribe

MySQL Administration

Change root password

From the command-line:

. /data/wre/sbin/setenvironment.sh
mysqladmin -u root -p oldpassword newpass

Forgotten Password:

  1. change your my.cnf:
    ...
    [mysqld]
    # this line for using mysqld without password
    skip_grant_tables
    ...
  2. restart mysqld
  3. login to mysql:
    linuxuser> mysql -u root mysql
  4. Change password for localhost and host:

    mysql> UPDATE user SET password=PASSWORD('new password')
    WHERE user='root' AND host='localhost';
    mysql> UPDATE user SET password=PASSWORD('new password')
    WHERE user='root' AND host='your_hostname';
    mysql> quit;
  5. change back my.cnf:
    ...
    [mysqld]
    #  this line for using mysqld without password
    # skip_grant_tables
    ...
  6. restart mysqld

View grants

Login to mysql as root:

show grants for 'poqlzsxjznphleb';

Checking & Repairing Databases

It's important to run a database check if you ever have an unexpected server outage or if you suspect table corruption.

1. Shutdown modperl:

 /data/wre/sbin/wreservices.pl --stop modperl

2. Run the check with auto-repair:

mysqlcheck -c -v -p --auto-repair --all-databases

3. Restart modperl:

 /data/wre/sbin/wreservices.pl --start modperl

You will get a report at the end of what tables were repaired and the status of the repaired tables. You may also need to shutdown SPECTRE and any other applications that are trying to connect to the database. See the MySQL manual for more details.

Keywords: mysql

Search | Most Popular | Recent Changes | Wiki Home
© 2023 Plain Black Corporation | All Rights Reserved