Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
    
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
add comment

6 Answers

Run the following command

mysql_install_db
share|improve this answer
add comment

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
share|improve this answer
add comment

The service could not be started. Error:0.

Add MySQL path to the environment variables.

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

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.

share|improve this answer
add comment

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.

share|improve this answer
add comment

Run mysql-test-run and you should see the following output :

./mysql-test-run
Logging: ./mysql-test-run  
2013-09-14 03:39:32 2566 [Warning] Setting lower_case_table_names=2 because file system for /var/folders/fr/sn4l2f393_v_ytcwkb0lx7_40000gp/T/_M2mZFQPjV/ is case insensitive
2013-09-14 03:39:32 2566 [Note] Plugin 'FEDERATED' is disabled.
2013-09-14 03:39:32 2566 [Note] Binlog end
2013-09-14 03:39:32 2566 [Note] Shutting down plugin 'MyISAM'
2013-09-14 03:39:32 2566 [Note] Shutting down plugin 'CSV'
MySQL Version 5.6.13
Checking supported features...
 - SSL connections supported
Using suites: main,sys_vars,binlog,federated,rpl,innodb,innodb_fts,perfschema,funcs_1,opt_trace,parts,auth_sec
Collecting tests...
 - adding combinations for binlog



 - adding combinations for rpl
Removing old var directory...
Creating var directory '/Users/das/mysql/mysql-5.6.13-osx10.7-x86_64/mysql-test/var'...
Installing system database...
Using server port 50409

==============================================================================

TEST                                      RESULT   TIME (ms) or COMMENT
--------------------------------------------------------------------------
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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