window 下mysql5.7.12安装报错记录
2016-06-02 21:45
483 查看
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
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
相关文章推荐
- MySQL中的integer 数据类型
- MySQL存储过程
- mysql中int、bigint、smallint 和 tinyint的区别与长度
- mysql load data 导出、导入 csv
- source命令执行SQL脚本文件
- MySQL创建用户及权限控制
- MySQL管理数据表
- linux下mysql添加用户
- mysql procedure
- mysql触发器
- MySQL 备份和恢复策略
- mac下安装mysql(转载)
- mysql 修改编码 Linux/Mac/Unix/通用(杜绝修改后无法启动的情况!)
- MySQL数据的导出、导入(mysql内部命令:mysqldump、mysql)
- mysql数据行转列
- Linux下修改MySQL编码的方法
- MySQL Server 日志
- MySQL 安全事宜
- MySQL 备份与恢复