Upgrade MySQL system tables

When you try to create a remote MySQL user, sometimes you may get the following the error.

ERROR 1146 (42S02): Table ‘mysql.procs_priv’ doesn’t exist

Why this error occurs?

MySQL system tables should be updated while upgrading MySQL version in the server and make sure that their structure is up to date. Otherwise, this error will occur when you create a remote user.

You can eliminate this error by executing the command in command prompt.

mysql_fix_privilege_tables –password=root_password

This command will update MySQL tables and its structure.

Note: Before executing this command, make sure that you have taken the full backup of MySQL.

MySQL: Access denied for user

MySQL Error : Error connecting to MySQL: Access denied for user: ‘root@localhost’ (Using password: YES)

This is mainly caused due to the fact that the user root does not have enough privileges to access the mysql databases or the password set for the user root to connect mysql was changed.

1. Start mysql using mysqld_safe

#/usr/local/etc/rc.d/mysqld stop
#mysqld_safe –skip-grant-tables &

Note:
mysqld_safe is used to start mysql server by disabling certain feature that restrict a user to access mysql. The option –skip-grant-tables is used to neglect the permission grant to different users of mysql.

2. Enter mysql prompt by just typing “mysql” and do the following

>GRANT ALL PRIVILEGES ON *.* TO root@localhost IDENTIFIED BY ‘newpassword’ WITH GRANT OPTION;
>FLUSH PRIVILEGES;
>\q

3. Kill all mysql processes and start mysqld

#killall -9 mysqld_safe
#killall -9 mysqld
#/usr/local/etc/rc.d/mysqld start

Method to take mysql dump of table structures

Inorder to take the dump of a database table structure you can use the option “-d” of mysqldump.

The syntax is given below.

$ mysqldump -u USERNAME -p -d DATABASENAME –tables TABLENAME1 TABLENAME2 > FILENAME.sql

Replace the USERNAME, DATABASENAME, TABLENAME, FILENAME with the original one.

You can verify the file for the table structures.

$ more FILENAME.sql

To Convert from vm-pop3d to Dovecot on Directadmin

To convert to dovecot from wu-imap or vm-pop3d, you can follow the steps given below

The “wu-imap” and “vm-pop3d” are in “mbox” format. The “Dovecot” is using the “Maildir” format.

cd /usr/local/directadmin/customapache
./build update
./build update_dovecot
./build dovecot
./build todovecot

Make sure that you do not stop the “todovecot” command as it can break the whole email system. It can take a long time to convert everything but do not stop it half way through.

Also, make sure that everything is working fine after the conversion.

You can clean the old “mbox” files by typing:

echo “action=delete&value=mbox” >> /usr/local/directadmin/data/task.queue

Checking the configuration of named.conf and zone files

The bind package has utilities to check the syntax of named.conf and any zone files. We can make use of those binaries to check our modifications done to those files before reloading or restarting named service.

To check the sytax of zone file /var/named/serverbuddies.com.db

[root@bash ~]# named-checkzone kb.com /var/named/serverbuddies.com.db
zone serverbuddies.com.db/IN: loaded serial 2006032401
OK

If everything is correct, it will show the serial number with which the zone file is loaded. Otherwise, it will give error message indicating the line number at which the error occured.

To check the syntax of named.conf file,

[root@bash ~]# named-checkconf /etc/named.conf

You may also load the configuration of all master zones listed in named.conf at the time of checking the syntax as,

[root@bash ~]# named-checkconf -z /etc/named.conf

The command will show a detailed output in case any error in named.conf file.

This way we can make sure that we are not editing the configuration file wrongly.

« Prev - Next »