mysql(一)下载、配置(免装版)
来源:互联网 发布:2016移动支付市场数据 编辑:程序博客网 时间:2024/05/21 07:51
阅读目录
- 下载MySQL免安装版
- 配置MySQL数据库
- MySQL环境变量
- 安装MySQL数据库
公司服务器是Windows 开发连接的数据库使用的是"MySQL"
此篇随笔将介绍在Windows上如何配置MySQL数据库免安装版
下载MySQL免安装版
- 首先进入MySQL 官方网站 www.mysql.com -->Downloads(下载) --> Community(社区) --> MySQL Community Server(MySQL社区服务器)-->选择操作系统平台(Windows)
- 下面有三个可选的下载文件
† 第一个是MySQL Installer 5.6 for Windows,下载下来是一个.msi可执行安装文件
† 后面两个是解压版(Zip版)分别是Windows (x86, 64-bit) ZIP Archive 和 Windows (x86, 32-bit), ZIP Archive
- 笔者选择的是 mysql-5.6.26-winx64.zip ,因为笔者的服务器版本是64位操作系统
配置MySQL数据库
- 将下载的 mysql-5.6.26-winx64.zip 解压自定义目录,这里笔者将把这个压缩包解压至 D:\mysql-5_x64 目录;
- 打开这个目录,发现里面的文件夹和文件跟一个安装好后的MySQL基本没有区别
- 修改MySQL配置文件,在mysql-5_x64目录下有一个my-default.ini,可以算作模板来使用,里面的内容不是很多!可以自己创建一个 my.ini作为MySQL配置文件,打开my.ini
[client]
port=3306
#客户端字符类型,与服务端一致就行,建议utf8
default-character-set=utf8
[mysqld]
#绑定IPv4和3306端口
bind-address = 0.0.0.0
port = 3306#服务端字符类型,建议utf8
character_set_server=utf8
# 设置mysql的安装目录
basedir=D:/mysql-5_x64
# 设置mysql数据库的数据的存放目录
datadir=D:/mysql-5_x64/data
# 允许最大连接数
max_connections=201
- 这样一个基本的MySQL环境所需要的参数就够了
MySQL环境变量
- 右击这台电脑-->属性-->高级-->环境变量-->"用户变量"新建变量MYSQL_HOME 值D:\mysql-5_x64 ,"系统变量"找到变量path 编辑 在后面加上 ;%MYSQL_HOME%\bin
安装MySQL数据库
- 运行cmd (Win8 、Win10以管理员运行cmd)-->进入D:\mysql-5_x64\bin目录
1
2
3
4
5
6
7
8
9
10
Microsoft Windows [版本 10.0.10240]
(c) 2015 Microsoft Corporation. All rights reserved.
C:\Windows\system32>D:
D:\>
cd
mysql-5_x64
D:\mysql-5_x64>
cd
bin
D:\mysql-5_x64\bin>
- 执行mysqld -install 安装MySQL
1
2
D:\mysql-5_x64\bin>mysqld -
install
Service successfully installed
- 执行net start mysql启动MySQL
1
2
3
4
D:\mysql-5_x64\bin>net start mysql
D:\mysql-5_x64\bin>net start mysql
MySQL 服务正在启动 .
MySQL 服务已经启动成功
启动MySQL服务:net start mysql
停止MySQL服务:net stop mysql
删除MySQL服务:sc delete mysql
- 修改Mysql密码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
D:\mysql-5_x64\bin>mysql -u root -p
//
使用root登入mysql
Enter password:
//
密码空,回车即可
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection
id
is 2
Server version: 5.6.26 MySQL Community Server (GPL)
Copyright (c) 2000, 2015, Oracle and
/or
its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and
/or
its
affiliates. Other names may be trademarks of their respective
owners.
Type
'help;'
or
'\h'
for
help. Type
'\c'
to
clear
the current input statement.
mysql>
1
2
3
4
5
6
7
8
9
10
mysql> show databases; //显示所有数据库
+
--------------------+
|
Database
|
+
--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
+
--------------------+
4
rows
in
set
(0.00 sec)
- 进入'mysql'数据、删除空用户
1
2
3
4
mysql> use mysql;
Database
changed
mysql>
delete
from
user
where
user
=
''
;
Query OK, 1 row affected (0.00 sec)
- 更新密码并重新刷权限表到内存(也可以用mysqladmin工具来设置密码)
1
2
3
4
5
6
mysql>
update
User
set
Password
=
PASSWORD
(
'123456'
)
where
User
=
'root'
;
Query OK, 4
rows
affected (0.00 sec)
Rows
matched: 4 Changed: 4 Warnings: 0
mysql> flush
privileges
;
Query OK, 0
rows
affected (0.00 sec)
- 尝试登陆
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
D:\mysql-5_x64\bin>mysql -u root -p //用root用户登入数据库
Enter
password
: ****** //输入更新后的密码 123456
Welcome
to
the MySQL monitor. Commands
end
with
;
or
\g.
Your MySQL
connection
id
is
5
Server version: 5.6.26 MySQL Community Server (GPL)
Copyright (c) 2000, 2015, Oracle
and
/
or
its affiliates.
All
rights reserved.
Oracle
is
a registered trademark
of
Oracle Corporation
and
/
or
its
affiliates. Other names may be trademarks
of
their respective
owners.
Type
'help;'
or
'\h'
for
help. Type
'\c'
to
clear the
current
input statement.
mysql>
- 开启远程连接(给予全部权限,允许 192.168.1.x 网段都可以连接)
1
2
3
4
5
6
7
8
9
10
11
12
mysql>
grant
all
privileges
on
*.*
to
'root'
@
'192.168.1.%'
identified
by
'root'
with
grant
option
;
Query OK, 0
rows
affected (0.00 sec)
mysql> flush
privileges
;
Query OK, 0
rows
affected (0.00 sec)
mysql>
select
host,
user
,
password
from
user
;
+
-------------+------+-------------------------------------------+
| host |
user
|
password
|
+
-------------+------+-------------------------------------------+
| 192.168.1.% | root | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B |
+
-------------+------+-------------------------------------------+
4
rows
in
set
(0.00 sec)
by: http://www.cnblogs.com/vforbox/p/4828151.html
0 0
- mysql(一)下载、配置(免装版)
- MySQL下载安装、配置(win7x64)
- mysql安装下载配置
- mysql下载安装配置
- mysql下载安装配置
- mysql下载、安装、配置
- mysql 下载安装配置
- ActiveAndroid (一):下载、配置与创建
- Maven(一)下载与环境变量配置
- Jenkins(一)下载安装与配置
- Maven下载、安装和配置(一)
- ACE下载配置一
- MySQL绿色版下载安装配置
- mysql下载、配置、安装使用
- MySQL的下载、安装、配置
- MySql下载、配置、安装、启动
- MySQL安装配置汇总(一)
- MySQL安装、配置和使用(一)
- 如何用CorelDRAW改变位图的尺寸和分辨率
- 第二周《C语言及程序设计》实践参考34 用循环累加
- WAS版本相关问题
- Android--退出整个应用程序
- 图结构练习——BFSDFS——判断可达性
- mysql(一)下载、配置(免装版)
- 小小的session配置,说不定会影响你的web项目性能
- FT9338指纹移植笔记
- ubStructInTree
- 数组
- sublime text 3下载安装及插件安装与配置(for前端)
- 要素类转为TXT文本
- linux下运行java引用外部类脚本
- 第2章 MapReduce 简介