Can't open and lock privilege tables: Table 'mysql.user' doesn't exist

前端 未结 6 1361
死守一世寂寞
死守一世寂寞 2020-12-24 00:38

I installed MySQL community server 5.7.10 using binary zip. I extracted the zip in c:\\mysql and created the data folder in c:\\mysql\\data. I crea

相关标签:
6条回答
  • 2020-12-24 01:15

    You have to initialize the data directory by running the following command

    mysqld --initialize [with random root password]

    mysqld --initialize-insecure [with blank root password]

    0 讨论(0)
  • 2020-12-24 01:17

    The mysql_install_db script also needs the datadir parameter:

    mysql_install_db --user=root --datadir=$db_datapath
    

    On Maria DB you use the install script mysql_install_db to install and initialize. In my case I use an environment variable for the data path. Not only does mysqld need to know where the data is (specified via commandline), but so does the install script.

    0 讨论(0)
  • 2020-12-24 01:19

    mysqld --initialize to initialize the data directory then mysqld &

    If you had already launched mysqld& without mysqld --initialize you might have to delete all files in your data directory

    You can also modify /etc/my.cnf to add a custom path to your data directory like this :

    [mysqld]
    ...  
    datadir=/path/to/directory
    
    0 讨论(0)
  • 2020-12-24 01:32

    As suggested above, i had similar issue with mysql-5.7.18,
    i did this in this way

    1. Executed this command from "MYSQL_HOME\bin\mysqld.exe --initialize-insecure"
    2. then started "MYSQL_HOME\bin\mysqld.exe"
    3. Connect workbench to this localhost:3306 with username 'root'
    4. then executed this query "SET PASSWORD FOR 'root'@'localhost' = 'root';"

    password was also updated successfully.

    0 讨论(0)
  • 2020-12-24 01:35

    I had the same problem. For some reason --initialize did not work. After about 5 hours of trial and error with different parameters, configs and commands I found out that the problem was caused by the file system.

    I wanted to run a database on a large USB HDD drive. Drives larger than 2 TB are GPT partitioned! Here is a bug report with a solution:

    https://bugs.mysql.com/bug.php?id=28913

    In short words: Add the following line to your my.ini:

    innodb_flush_method=normal
    

    I had this problem with mysql 5.7 on Windows.

    0 讨论(0)
  • 2020-12-24 01:36

    in laragon delete all internal data files from "C:\laragon\data\mysql" and restart it, that worked for me

    0 讨论(0)
提交回复
热议问题