0

I have updated my Ubuntu server from 8.04 LTS to 10.04 LTS and faced problems with the MySQL server installation. Steps which I have done:

1) Removed MySQL on Ubuntu 8.04
2) Updated OS to Ubuntu 10.04 LTS
3) Installed MySQL 5.1 from repositories
4) Stopped new MySQL server and ran mysql_upgrade

Here is the error I am getting:

Looking for 'mysql' as: mysql
Looking for 'mysqlcheck' as: mysqlcheck
Running 'mysqlcheck' with connection arguments: '--port=3306' '--socket=/var/run/mysqld/mysqld.sock' 
mysqlcheck: Got error: 2002: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) when trying to connect
FATAL ERROR: Upgrade failed

Here are log entries written at the same time:

111205  2:56:56 [Note] Plugin 'FEDERATED' is disabled.
111205  2:56:56  InnoDB: Started; log sequence number 52 181390868
111205  2:56:56 [ERROR] Column count of mysql.db is wrong. Expected 22, found 20. Created with MySQL 50051, now running 50141. Please use mysql_upgrade to fix this error.
111205  2:56:56 [ERROR] mysql.user has no `Event_priv` column at position 29
111205  2:56:56 [ERROR] Event Scheduler: An error occurred when initializing system tables. Disabling the Event Scheduler.
111205  2:56:56 [Note] /usr/sbin/mysqld: ready for connections.
Version: '5.1.41-3ubuntu12.10'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  (Ubuntu)
111205  2:56:57 [Note] /usr/sbin/mysqld: Normal shutdown

111205  2:56:57  InnoDB: Starting shutdown...
111205  2:56:57  InnoDB: Shutdown completed; log sequence number 52 181390868
111205  2:56:57 [Note] /usr/sbin/mysqld: Shutdown complete

Could someone at least point me into correct direction to fix the problem? I googled and spent much time trying to resolve this issue myself. Thank you for any help.

UPDATE 1

  • I have backuped and removed /var/lib/mysql/mysql
  • ran mysql_install_db
  • mysqld --skip-grant-tables --user=mysql
  • mysql_upgrade

I am getting the following errors:

root@server:~# mysql_upgrade Looking for 'mysql' as: mysql Looking for 'mysqlcheck' as: mysqlcheck Running 'mysqlcheck' with connection arguments: '--port=3306' '--socket=/var/run/mysqld/mysqld.sock' mysqlcheck: Got error: 2002: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111) when trying to connect FATAL ERROR: Upgrade failed

1
  • you have to start the server - /etc/init.d/mysqld start - before running mysql_upgrade
    – Olivier S
    Dec 4, 2011 at 20:46

1 Answer 1

2

Backup all your /var/lib/mysql/* directories, then remove /var/lib/mysql/mysql and run

mysql_installdb

This will create a fresh mysql database and allow your server to start. Then the first thing to do will be to run mysql_upgrade in order to migrate your databaes.

2
  • Thank you for your answer. I have updated my post. Would you please advise me?
    – Andrew
    Dec 4, 2011 at 20:07
  • 1
    you have to start the server before running mysql_upgrade
    – Olivier S
    Dec 4, 2011 at 20:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .