window 下mysql5.7.12安装报错记录

1)官网下载mysql5.7.17解压

my-default.ini文件命名为my.ini:

----------------------------------------------------------------------------------

# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html
# *** DO NOT EDIT THIS FILE. It's a template which will be copied to the
# *** default location during install, and will be replaced if you
# *** upgrade to a newer version of MySQL.


[mysqld]


# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M


# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin


# These are commonly set, remove the # and set as required.
character-set-server=utf8
collation-server=utf8_general_ci
basedir = "D:\mysql-5.7.12"
datadir = "D:\mysql-5.7.12\data"
port = 3306
# server_id = .....




# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M 


sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES 


[mysql]
default_character_set=utf8


[mysql.server]
default_character_set = utf8


[mysqld_safe]
default_character_set = utf8


[client]

default_character_set = utf8


-----------------------------------------------------------------------------------------------

2)安装服务:

mysqld -install mysql

net start mysql

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

直接用命令初始化:

指定配置文件:mysqld --install mysql --defaults-file="D:\mysql-5.7.12\my.ini
初始化:mysqld --defaults-file=D:\mysql-5.7.12\my.ini --initialize 


3)修改密码:

mysqld --skip-grant-tables 启动mysql

打开新的cmd:mysql -u root mysql

mysql> UPDATE user SET password=PASSWORD('root') WHERE user='root';

4)远程登陆mysql

例如,你想myuser使用mypassword从任何主机连接到mysql服务器的话。


GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'%' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;


FLUSH   PRIVILEGES;


如果你想允许用户myuser从ip为192.168.1.6的主机连接到mysql服务器,并使用mypassword作为密码


GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'192.168.1.3' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;


FLUSH   PRIVILEGES;



OK 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值