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 created the config file as my.ini
and placed it in c:\mysql
(root folder of extracted zip). Below is the content of the my.ini
file
我使用二进制压缩安装了MySQL community server 5.7.10。我提取了c:\mysql中的zip文件,并在c:\mysql\数据中创建了数据文件夹。我创建了配置文件作为我的。把它放在c:\mysql(提取zip的根文件夹)。下面是我的内容。ini文件
# set basedir to your installation path
basedir=C:\mysql
# set datadir to the location of your data directory
datadir=C:\mysql\data
I'm trying to start MySQL using mysqld --console
, but the process is aborted with the below error.
我正在尝试使用mysqld -console启动MySQL,但是该进程由于以下错误而终止。
2015-12-29T18:04:01.141930Z 0 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist
2015-12-29T18:04:01.141930Z 0 [ERROR] Aborting
Any help on this will be appreciated.
如有任何帮助,我们将不胜感激。
4 个解决方案
#1
43
You have to initialize the data directory by running the following command
您必须通过运行以下命令来初始化数据目录
mysqld --initialize
[with random root password]
mysqld——初始化[使用随机根密码]
mysqld --initialize-insecure
[with blank root password]
mysqld——初始化-不安全[使用空白根密码]
#2
2
mysqld --initialize to initialize the data directory then mysqld &
mysqld——初始化数据目录,然后是mysqld &
If you had already launched mysqld& without mysqld --initialize you might have to delete all files in your data directory
如果已经启动了mysqld&without sqmyld——initialize,那么您可能必须删除数据目录中的所有文件
You can also modify /etc/my.cnf to add a custom path to your data directory like this :
您还可以修改/etc/my.cnf,向数据目录添加自定义路径,如下所示:
[mysqld]
...
datadir=/path/to/directory
#3
0
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';"
如上所述,我对mysql-5.7.18也有类似的问题,我是这样做的1。从“MYSQL_HOME\bin\mysqld”执行此命令。exe - initialize-insecure”2。然后开始“MYSQL_HOME \ bin \ mysqld。exe”3。使用用户名“root”4将workbench连接到这个本地主机:3306。然后执行这个查询“为'root'@'localhost' = 'root'设置密码;”
password was also updated successfully.
密码也被成功更新。
#4
0
On Maria DB you use mysql_install_db
. In my case I use and environment variable for the data path, which means not only does mysqld need to know where via commandline, but so does the install script:
在Maria DB上,您使用mysql_install_db。在我的例子中,我使用和环境变量作为数据路径,这意味着mysqld不仅需要通过命令行知道在哪里,而且安装脚本也需要知道:
mysql_install_db --user=root --datadir=$db_datapath
#1
43
You have to initialize the data directory by running the following command
您必须通过运行以下命令来初始化数据目录
mysqld --initialize
[with random root password]
mysqld——初始化[使用随机根密码]
mysqld --initialize-insecure
[with blank root password]
mysqld——初始化-不安全[使用空白根密码]
#2
2
mysqld --initialize to initialize the data directory then mysqld &
mysqld——初始化数据目录,然后是mysqld &
If you had already launched mysqld& without mysqld --initialize you might have to delete all files in your data directory
如果已经启动了mysqld&without sqmyld——initialize,那么您可能必须删除数据目录中的所有文件
You can also modify /etc/my.cnf to add a custom path to your data directory like this :
您还可以修改/etc/my.cnf,向数据目录添加自定义路径,如下所示:
[mysqld]
...
datadir=/path/to/directory
#3
0
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';"
如上所述,我对mysql-5.7.18也有类似的问题,我是这样做的1。从“MYSQL_HOME\bin\mysqld”执行此命令。exe - initialize-insecure”2。然后开始“MYSQL_HOME \ bin \ mysqld。exe”3。使用用户名“root”4将workbench连接到这个本地主机:3306。然后执行这个查询“为'root'@'localhost' = 'root'设置密码;”
password was also updated successfully.
密码也被成功更新。
#4
0
On Maria DB you use mysql_install_db
. In my case I use and environment variable for the data path, which means not only does mysqld need to know where via commandline, but so does the install script:
在Maria DB上,您使用mysql_install_db。在我的例子中,我使用和环境变量作为数据路径,这意味着mysqld不仅需要通过命令行知道在哪里,而且安装脚本也需要知道:
mysql_install_db --user=root --datadir=$db_datapath