database

All posts tagged database

I spent a little time recently creating a new blog to act as a business landing page.

To make it simple, I am going to use WordPress. Actually installing WordPress is very simple; just unzip it in the right place and follow the wizard to create a wp-config.php file.

The trick I had was creating the database and user. I ran these commands:
mysql> CREATE DATABASE newdatabase;
mysql> GRANT ALL PRIVILEGES ON newusername.* TO “newdatabase”@”localhost”
-> IDENTIFIED BY “somepassword”;
mysql> FLUSH PRIVILEGES;

The FLUSH PRIVILEGES command had an error:
ERROR 1146 (42S02): Table ‘mysql.servers’ doesn’t exist

A bit of google-fu revealed some SQL to run. My supposition is that during a recent upgrade of mysql server, this table became a requirement but was not created as part of the upgrade.

Here is the SQL to create an empty table in the mysql database.
CREATE TABLE `servers` (
`Server_name` char(64) NOT NULL,
`Host` char(64) NOT NULL,
`Db` char(64) NOT NULL,
`Username` char(64) NOT NULL,
`Password` char(64) NOT NULL,
`Port` int(4) DEFAULT NULL,
`Socket` char(64) DEFAULT NULL,
`Wrapper` char(64) NOT NULL,
`Owner` char(64) NOT NULL,
PRIMARY KEY (`Server_name`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8
COMMENT='MySQL Foreign Servers table';

Once I created that table, the FLUSH PRIVILEGES command worked without error and WordPress did all the DB work needed without complaint.