mysql windows 安装_Windows下MySQL的安装与配置

1.1 Windows(MySql Server5.7.15,推荐):下载installer直接安装

win10 安装mysql错误2503 2502 时,修改C:WindowsTemp,右键,添加管理员权限。

1.2 Windows下载server配置安装。

建议下载installer直接GUI配置。

1.2.1 下载MySqlServer社区版

51868d84ea2754537e0b41b393e7b96b.png

1.2.2 配置ini

1.2.2.1 Copy根目录中的mydefault.ini,重命名为my.ini(mysql默认读取此文件)。

1.2.2.2 修改以下内容:

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:ProgramDatamysql-5.7.15-winx64

datadir = D:ProgramDatamysql-5.7.15-winx64data

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:ProgramDatamysql-5.7.15-winx64bin>mysqld --initialize --user=mysql

1.2.4 服务安装:mysqld install

D:ProgramDatamysql-5.7.15-winx64bin>mysqld install

Service successfully installed.

1.2.5 服务启动:net start mysql

D:ProgramDatamysql-5.7.15-winx64bin>net start mysql

MySQL 服务正在启动 .

MySQL 服务已经启动成功。

1.2.6 服务停止:net stop mysql

D:ProgramDatamysql-5.7.15-winx64bin>net stop mysql

MySQL 服务正在停止.

MySQL 服务已成功停止。

1.2.7 服务删除:net stop mysql

D:ProgramDatamysql-5.7.15-winx64bin>mysqld remove

Service successfully removed.

1.3 远程连接root:开启远程访问权限

默认情况下,只有localhost用户能连接到mysql。如果要使用远程,需要在mysql数据库的user表中增加机器名(不是IP,使用%则允许所有机器)。然后重启mysql服务。

9d56fa8d276cc62936f8bc159ed25e1d.png

查看: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。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值