mysql-python:不能打开和锁定特权表:表'mysql。主机不存在

时间:2021-11-13 06:46:55

I installed mysql using homebrew.

我用自制软件安装了mysql。

I'm now trying to install mysql-python and I keep getting the error below when I run mysql.

我现在正在尝试安装mysql-python,当我运行mysql时,我总是会得到下面的错误。

I'm new to programming and don't know enough to identify the problem.

我是编程新手,不知道什么是问题。

Any help will be appreciated. Thanks.

如有任何帮助,我们将不胜感激。谢谢。

 TDNS-Mac-mini:~ TDNS$ easy_install mysql-python
    /Library/Frameworks/Python.framework/Versions/2.7/bin/easy_install:5: UserWarning: Module pkg_resources was already imported from /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/pkg_resources.pyc, but /Library/Python/2.7/site-packages/distribute-0.6.24-py2.7.egg is being added to sys.path
      from pkg_resources import load_entry_point
    /Library/Frameworks/Python.framework/Versions/2.7/bin/easy_install:5: UserWarning: Module site was already imported from /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.pyc, but /Library/Python/2.7/site-packages/distribute-0.6.24-py2.7.egg is being added to sys.path
      from pkg_resources import load_entry_point
    Searching for mysql-python
    Reading http://pypi.python.org/simple/mysql-python/
    Reading http://sourceforge.net/projects/mysql-python/
    Reading http://sourceforge.net/projects/mysql-python
    Best match: MySQL-python 1.2.3
    Downloading http://download.sourceforge.net/sourceforge/mysql-python/MySQL-python-1.2.3.tar.gz
    Processing MySQL-python-1.2.3.tar.gz
    Running MySQL-python-1.2.3/setup.py -q bdist_egg --dist-dir /var/folders/c9/xzv35t2n3ld9lgjrtl0vd0xr0000gn/T/easy_install-LsUpDW/MySQL-python-1.2.3/egg-dist-tmp-vzGMr9
    warning: no files found matching 'MANIFEST'
    warning: no files found matching 'ChangeLog'
    warning: no files found matching 'GPL'
    unable to execute gcc-4.2: No such file or directory
    error: Setup script exited with error: command 'gcc-4.2' failed with exit status 1

TDNS-Mac-mini:~ TDNS$ mysqld
        120414 22:02:41 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/var/mysql/ is case insensitive
        mysqld: Table 'mysql.plugin' doesn't exist
        120414 22:02:41 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
        120414 22:02:41 InnoDB: The InnoDB memory heap is disabled
        120414 22:02:41 InnoDB: Mutexes and rw_locks use GCC atomic builtins
        120414 22:02:41 InnoDB: Compressed tables use zlib 1.2.5
        120414 22:02:41 InnoDB: Initializing buffer pool, size = 128.0M
        120414 22:02:41 InnoDB: Completed initialization of buffer pool
        120414 22:02:41 InnoDB: highest supported file format is Barracuda.
        InnoDB: The log sequence number in ibdata files does not match
        InnoDB: the log sequence number in the ib_logfiles!
        120414 22:02:41  InnoDB: Database was not shut down normally!
        InnoDB: Starting crash recovery.
        InnoDB: Reading tablespace information from the .ibd files...
        InnoDB: Restoring possible half-written data pages from the doublewrite
        InnoDB: buffer...
        120414 22:02:41  InnoDB: Waiting for the background threads to start
        120414 22:02:42 InnoDB: 1.1.8 started; log sequence number 1595675
        120414 22:02:42 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist

1 个解决方案

#1


12  

I figured it out. I forgot to follow the instructions at the top of the homebrew install notes in terminal.

我想出来。我忘记了在终端上的homebrew安装说明上的说明。

Hope saves time for others who make the same mistake.

希望为犯同样错误的人节省时间。

Set up databases to run AS YOUR USER ACCOUNT with:
    unset TMPDIR
    mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp

To set up base tables in another folder, or use a different user to run
mysqld, view the help for mysqld_install_db:
    mysql_install_db --help

and view the MySQL documentation:
  * http://dev.mysql.com/doc/refman/5.5/en/mysql-install-db.html
  * http://dev.mysql.com/doc/refman/5.5/en/default-privileges.html

To run as, for instance, user "mysql", you may need to `sudo`:
    sudo mysql_install_db ...options...

Start mysqld manually with:
    mysql.server start

    Note: if this fails, you probably forgot to run the first two steps up above

#1


12  

I figured it out. I forgot to follow the instructions at the top of the homebrew install notes in terminal.

我想出来。我忘记了在终端上的homebrew安装说明上的说明。

Hope saves time for others who make the same mistake.

希望为犯同样错误的人节省时间。

Set up databases to run AS YOUR USER ACCOUNT with:
    unset TMPDIR
    mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp

To set up base tables in another folder, or use a different user to run
mysqld, view the help for mysqld_install_db:
    mysql_install_db --help

and view the MySQL documentation:
  * http://dev.mysql.com/doc/refman/5.5/en/mysql-install-db.html
  * http://dev.mysql.com/doc/refman/5.5/en/default-privileges.html

To run as, for instance, user "mysql", you may need to `sudo`:
    sudo mysql_install_db ...options...

Start mysqld manually with:
    mysql.server start

    Note: if this fails, you probably forgot to run the first two steps up above