win7怎么安装mysql zip包
2016-06-28 · 知道合伙人软件行家
工具:win7系统电脑一台、MySQLzip格式安装包
步骤:
1、MySQLzip格式是自己解压,解压缩之后其实MySQL就可以使用了,但是要进行配置。解压之后可以将该文件夹改名,放到合适的位置。
2、点击我的电脑->属性->高级->环境变量,选择PATH,在其后面添加: mysql bin文件夹的路径 (如:C:\Program Files\MySQL\MySQL Server 5.6\bin )。
3、mysql-5.6.1X默认的配置文件是在C:\Program Files\MySQL\MySQL Server 5.6\my-default.ini,或者自己建立一个my.ini文件,在其中修改或添加配置:
[mysqld]
basedir=C:\Program Files\MySQL\MySQL Server 5.6(mysql所在目录)
datadir=C:\Program Files\MySQL\MySQL Server 5.6\data (mysql所在目录\data)
4、以管理员身份运行cmd,输入:cd C:\Program Files\MySQL\MySQL Server 5.6\bin 进入mysql的bin文件夹。输入mysqld -install。安装成功。
1、将解压缩后的文件放到自己想要的地方,并配置环境变量。示例中存放的目录为:F:\mysql\mysql-5.6.14-winx64
2、在环境变量中添加:MYSQL_HOME:F:\mysql\mysql-5.6.14-winx64,在path路径中加入:%MYSQL_HOME%\bin。配置环境变量不是必须的,只是为了能更方便的在命令行中使用mysql的命令行工具。
3、修改ini配置文件
5.6.14的解压缩版里有一个my-default.ini文件,copy一份改名为my.ini放在同级目录下。修改my.ini, my.ini内容如下:
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.6/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]
loose-default-character-set=utf8
basedir = F:/mysql/mysql-5.6.14-winx64
datadir = F:/mysql/mysql-5.6.14-winx64/data
[client]
loose-default-character-set=utf8
[WinMySQLadmin]
Server=F:/mysql/mysql-5.6.14-winx64/bin/mysqld.exe
# 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
# 设置mysql的安装目录
# 设置mysql数据库的数据存放目录
# These are commonly set, remove the # and set as required.
# basedir = .....
# datadir = .....
# port = .....
# server_id = .....
character-set-server=utf8
# 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
4、安装服务
开始——所有程序——附件——命令提示符,右键以管理员身份运行。 输入命令:
C:\>f:
F:\>cd F:\mysql\mysql-5.6.14-winx64\bin
F:\mysql\mysql-5.6.14-winx64\bin>mysqld -install
Service successfully installed.
5、启动服务
F:\mysql\mysql-5.6.14-winx64\bin>cd\
F:\>net start mysql
MySQL 服务正在启动 .
MySQL 服务已经启动成功。
6、配置用户
还在上面的命令窗口里面,输入命令:mysql -u root -p
回车后提示输入密码。
mysql解压缩版初次安装管理员root的密码为空,因此直接再回车一次就登入mysql数据库了。
F:\>mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.14 MySQL Community Server (GPL)
Copyright (c) 2000, 2013, 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.
成功后
输入命令:use mysql; /*使用mysql数据库*/
mysql> use mysql
Database changed
输入命令:select host,user,password from user; /* 查看系统的账户信息 */
mysql> select host,user,password from user;
+-----------+------+----------+
| host | user | password |
+-----------+------+----------+
| localhost | root | |
| 127.0.0.1 | root | |
| ::1 | root | |
| localhost | | |
+-----------+------+----------+
4 rows in set (0.00 sec)
host:代表mysql服务允许哪个IP来的请求。localhost和127.0.0.1指mysql服务所在的主机,即本地。::1是IPV6的IP地址写法,
全称为:0000:0000:0000:0000:0000:0000:0000:0001。现在都是IPV4的网络,可以不用管他。
user:指账户名称。不同的host下账户名称可以相同。
password:密码。
可以看到,默认账户里只支持本地连接,并且账户没有密码。现在的问题明确了,就是要将匿名用户删除,为root用户添加远程访问和密码,再为自己添加个人账户。指令如下:
mysql> update user set password=PASSWORD('root') where user='root';
Query OK, 3 rows affected (0.00 sec)
Rows matched: 3 Changed: 3 Warnings: 0
mysql> grant all on *.* to root@'%' identify by 'root';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'ident
ify by 'root'' at line 1
mysql> grant all on *.* to walle@'%' identify by '123456' with grant option;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'ident
ify by '123456' with grant option' at line 1
mysql> delete from where user='';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'where
user=''' at line 1
mysql> select host,user,password from user;
+-----------+------+-------------------------------------------+
| host | user | password |
+-----------+------+-------------------------------------------+
| localhost | root | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B |
| 127.0.0.1 | root | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B |
| ::1 | root | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B |
| localhost | | |
+-----------+------+-------------------------------------------+
4 rows in set (0.00 sec)
mysql> commit;
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
2016-03-23
2、在打开的窗口中,选择接受安装协议,单击“next”继续安装.
3、在出现选择安装类型的窗口中,有“typical(默认)”、“Complete(完全)”、“Custom(用户自定义)”三个选项,我们选择“Custom”,因为通过自定义可以更加的让我们去熟悉它的安装过程,单击“next”继续安装.
4、在出现自定义安装界面中选择mysql数据库的安装路径,这里我设置的是“d:\Program File\MySQL”,单击“next”继续安装.
5、接下来进入到准备安装的界面,首先确认一下先前的设置,如果有误,按“back”返回,没有错误,单击“Install”按钮继续安装.
6、单击“Install”按钮之后出现如下正在安装的界面,经过很少的时间,MySQL数据库安装完成,出现完成MySQL安装的界面.
7、界面单击“next.
注意要选择上边的“Launch the MySQL Instance Configuration Wizard”选项,这是启动MySQL的配置,单击“Finish”按钮,进入到配置界面。
如果是要本地搭建mysql+php环境以测试网站的话,建议用一键式搭建软件
可以用APMServ,这是一套一键搭建本地运行环境的软件哦
推荐使用phpStudy,这套软件在百度的软件库里也能找到
phpStudy也是一键安装搭建php+mysql环境的,设置也非常简单,界面简洁
phpStudy自带有多个php版本和mysql版本。可以在控制面板随意切换版本号以方便你测试使用
同时phpStudy还有phpmyadmin,通过这个软件方便你随时快捷方便的管理你的mysql数据库
广告 您可能关注的内容 |