All of a sudden my local MySQL 5.5 server stopped running on my Windows XP SP3.

I also have WAMP Apache and WAMP MySQL installed, but WAMP MySQL is not running. Error log shows:

  • Can't start server: Bind on TCP/IP port: No such file or directory
  • Do you already have another mysqld server running on port: 3306 ?

I tried changing the port from 3306 to 3307, but the service would still not start, giving error:

The Event Viewer shows:

  • Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist
  • Can't open the mysql.plugin table. Please run mysql_upgrade to create it.

Apparently, I can only run mysql_upgrade if the server is running. How can I create 'mysql.host' if the service can't be started?

I uninstalled MySQL Server and reinstalled it, and during the config wizard after installation, I receive an error: The service could not be started. Error:0.

How do I proceed from here?

link|improve this question

44% accept rate
Steve are you running this on Windows, BSD, Linux, OSX, or some other OS? If you are running it on Windows the details for some steps will be different. – Rik Schneider Jul 28 '11 at 23:49
@Rik Schneider: Rick, I am running MySQL on my Windows laptop. Thanks. – Steve Jul 31 '11 at 11:18
feedback

5 Answers

Run the following command

mysql_install_db
link|improve this answer
feedback

The first thing you need to do is run these commands:

use mysql
show tables;

Please note the differences

MySQL 5.0 has 17 tables in the mysql schema

+---------------------------+
| Tables_in_mysql           |
+---------------------------+
| columns_priv              |
| db                        |
| func                      |
| help_category             |
| help_keyword              |
| help_relation             |
| help_topic                |
| host                      |
| proc                      |
| procs_priv                |
| tables_priv               |
| time_zone                 |
| time_zone_leap_second     |
| time_zone_name            |
| time_zone_transition      |
| time_zone_transition_type |
| user                      |
+---------------------------+

MySQL 5.1 has 23 tables in the mysql schema

+---------------------------+
| Tables_in_mysql           |
+---------------------------+
| columns_priv              |
| db                        |
| event                     |
| func                      |
| general_log               |
| help_category             |
| help_keyword              |
| help_relation             |
| help_topic                |
| host                      |
| ndb_binlog_index          |
| plugin                    |
| proc                      |
| procs_priv                |
| servers                   |
| slow_log                  |
| tables_priv               |
| time_zone                 |
| time_zone_leap_second     |
| time_zone_name            |
| time_zone_transition      |
| time_zone_transition_type |
| user                      |
+---------------------------+

MySQL 5.5 has 24 tables in the mysql schema

+---------------------------+
| Tables_in_mysql           |
+---------------------------+
| columns_priv              |
| db                        |
| event                     |
| func                      |
| general_log               |
| help_category             |
| help_keyword              |
| help_relation             |
| help_topic                |
| host                      |
| ndb_binlog_index          |
| plugin                    |
| proc                      |
| procs_priv                |
| proxies_priv              |
| servers                   |
| slow_log                  |
| tables_priv               |
| time_zone                 |
| time_zone_leap_second     |
| time_zone_name            |
| time_zone_transition      |
| time_zone_transition_type |
| user                      |
+---------------------------+

Please note that mysql.plugin does not exist in MySQL 5.0. It is very plausible to surmise that you somehow installed MySQL 5.0 and made vital tables for MySQL 5.5 disappear.

Here is some good news. There is something you can try.

For this example

  • ServerA is where your MySQL 5.5 data lives
  • ServerB is where you will create a separate MySQL 5.5 environment

Here are your steps

  1. On ServerA, mkdir /root/myusers
  2. On ServerA, cp /var/lib/mysql/mysql/user.* /root/myusers/.
  3. Install MySQL 5.5 on ServerB
  4. scp ServerB:/var/lib/mysql/mysql/* ServerA:/var/lib/mysql/mysql/.
  5. On ServerA, cp /root/myusers/user.* /var/lib/mysql/mysql/.
  6. service mysql start

That's it.

If you are running this in Windows, the same principles have to apply.

Give it a Try !!!

UPDATE 2011-07-29 16:15 EDT

If your usernames had DB Specific Privileges, here are your steps

  1. On ServerA, mkdir /root/myusers
  2. On ServerA, cp /var/lib/mysql/mysql/user.* /root/myusers/.
  3. On ServerA, cp /var/lib/mysql/mysql/db.* /root/myusers/.
  4. Install MySQL 5.5 on ServerB
  5. scp ServerB:/var/lib/mysql/mysql/* ServerA:/var/lib/mysql/mysql/.
  6. On ServerA, cp /root/myusers/* /var/lib/mysql/mysql/.
  7. service mysql start
link|improve this answer
feedback

The service could not be started. Error:0.

Add MySQL path to the environment variables.

link|improve this answer
Thanks, but it was already in the Path variable. – Steve Jul 31 '11 at 8:23
feedback

it looks like u already have mysql running

try

ps ax|grep mysql

if u see some output, probably u need stop it(or reboot box).

if u not see any output, try run mysqld without demonize and see output.

link|improve this answer
feedback

I've added a windows tag to help people answer the question.

My background is not windows but the principals apply.

Is there a mysql process already running? If so you will need to kill it before uninstalling. If it was still running when you tried to uninstall/reinstall you will have processes and files hanging around preventing you from uninstalling completely.

Open up the services window, look for anything with mysql in the name, and ensure that it is set to not attempt to start with a reboot. Then open up the running processes tab of the running programs window (use CTRL-ALT-DEL to open) and look for and kill running processes with mysql in the name.

If you are satisfied that there are no more running mysql processes you can continue. You may want to reboot to be certain no more running mysql processes are hanging around.

At this time you should be able to reinstall and start mysql.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.