MySQL startup prompt: mysql. host does not exist. startup failed [problem solved]

Source: Internet
Author: User

After I delete the S9 public mysql4.0, I re-installed a new mysql5.0. During the startup process, an error is reported, indicating that the startup failed, I checked the old posts in the group and did not provide a specific explanation. I also asked the expert to explain how to solve the problem. Thank you.
Records in the error log:

[Error] fatal error: Can't open and lock privilege tables: Table 'mysql. host' doesn' t exist

I posted a post. I only saw it, but no one replied. I can only solve the problem by myself. Can I help myself... You don't have to mention it. It actually solved the problem. People are all forced out ,.... there is no way. This problem may be a very simple problem for the experts, but for the first time I touched MySQL, I did not understand it.
Now, let's talk about the process of solving the problem:

Follow the MySQL installation steps:
Shell> groupadd MySQL
Shell> useradd-G MySQL
Shell> gunzip | mysql-VERSION.tar.gz | tar-xvf-
Shell> Cd mysql-version
Shell>./configure -- prefix =/usr/local/MySQL
Shell> make
Shell> make install
Shell> scripts/mysql_install_db -- user = MySQL
Shell> chown-r root/usr/local/MySQL
Shell> chown-r MySQL/usr/local/MySQL/var
Shell> chgrp-r MySQL/usr/local/MySQL
Shells> CP support-files/my-medium.cnf/etc/My. CNF
Shell>/usr/local/MySQL/bin/mysqld_safe -- user = MySQL &

There is no problem with this standard, but when I start MySql in the last step, I want to put the database data file under another directory and change the startup command:
Shell>/usr/local/MySQL/bin/mysqld_safe -- user = MySQL -- log-error =/u01/MySQL/mysql_error/error -- datadir =/u01/MySQL/Data

This problem occurs because the permission table created by default is under the default directory/usr/local/MySQL/var when initializing the database permission table, this leads to the failure to find the permission table: Can't open and lock privilege tables: Table 'mysql. host 'doesn' t exist

solution: When you run the initialization permission table, use the added parameter datadir. The command format is:
shell> scripts/mysql_install_db -- user = MySQL -- datadir =/u01/MySQL/Data
the problem is solved.
this problem also occurs when you change the data file of your database to another directory, because you have not created a database permission table in the corresponding directory, the solution is to re-run the mysql_install_db file to regenerate the database permission table, but you also need to re-create the user and Set permissions; the second method should be to copy the files in the old permission table to the corresponding database table directory first, but the second method I did not use is just based on my own imagination. If you have a master, check whether the master is correct.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.