标签:
阅读目录
公司服务器是Windows 开发连接的数据库使用的是"MySQL"
此篇随笔将介绍在Windows上如何配置MySQL数据库免安装版
† 第一个是MySQL Installer 5.6 for Windows,下载下来是一个.msi可执行安装文件
† 后面两个是解压版(Zip版)分别是Windows (x86, 64-bit), ZIP Archive 和 Windows (x86, 32-bit), ZIP Archive
[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
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>
D:\mysql-5_x64\bin>mysqld -install Service successfully installed
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服务:mysqld -remove
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>
mysql> show databases; //显示所有数据库 +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | test | +--------------------+ 4 rows in set (0.00 sec)
mysql> use mysql; Database changed mysql> delete from user where user=‘‘; Query OK, 1 row affected (0.00 sec)
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)
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>
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)
好了大功告成,Mysql 免安装版就已经安装完成了
标签:
原文地址:http://www.cnblogs.com/vforbox/p/4828151.html