win7下mysql安装教程:Windows下MySQL的安装与配置
win7下mysql安装教程:Windows下MySQL的安装与配置# For advice on how to change settings please see//my.iniPort为端口号。Skip-grant-table为跳过用户表,如果不配置则无法进入mysql(开启远程访问)。default_password_lifetime为设置密码生命周期,设置为0则永不过期。
1.1 Windows(MySQL Server5.7.15,推荐):下载installer直接安装win10 安装mysql错误2503 2502 时,修改C:\Windows\Temp,右键,添加管理员权限。
1.2 Windows下载server配置安装。建议下载installer直接GUI配置。
1.2.1 下载MySqlServer社区版Basedir为mysql目录。
Datadir为mysql数据目录。
Port为端口号。
Skip-grant-table为跳过用户表,如果不配置则无法进入mysql(开启远程访问)。
default_password_lifetime为设置密码生命周期,设置为0则永不过期。
//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.
basedir = D:\ProgramData\mysql-5.7.15-winx64
datadir = D:\ProgramData\mysql-5.7.15-winx64\data
port = 3306
# server_id = .....
skip-grant-tables
default_password_lifetime=0
# 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
1.2.2.3 设置编码格式参考:http://www.cr173.com/html/50452_1.html
设置客户端编码:【client】
[client]
default-character-set=utf8
设置服务端编码:【mysqld】
[mysqld]
character_set_server=utf8
1.2.3 初始化:mysqld --initialize --user=mysql--user=mysql用于linux服务运行用户,Windows可以忽略。
D:\ProgramData\mysql-5.7.15-winx64\bin>mysqld --initialize --user=mysql
1.2.4 服务安装:mysqld installD:\ProgramData\mysql-5.7.15-winx64\bin>mysqld install
Service successfully installed.
1.2.5 服务启动:net start mysqlD:\ProgramData\mysql-5.7.15-winx64\bin>net start mysql
MySQL 服务正在启动 .
MySQL 服务已经启动成功。
1.2.6 服务停止:net stop mysqlD:\ProgramData\mysql-5.7.15-winx64\bin>net stop mysql
MySQL 服务正在停止.
MySQL 服务已成功停止。
1.2.7 服务删除:net stop mysqlD:\ProgramData\mysql-5.7.15-winx64\bin>mysqld remove
Service successfully removed.
1.3 远程连接root:开启远程访问权限默认情况下,只有localhost用户能连接到mysql。如果要使用远程,需要在mysql数据库的user表中增加机器名(不是IP,使用%则允许所有机器)。然后重启mysql服务。
查看:select host user password from user;
授权:GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION;
刷新:flush privileges;
1.4 网页管理工具adminer使用一个php文件的mysql web端管理工具adminer。