Mysql| Mysql5.6软件的安装

来源:互联网 发布:js中display的值 编辑:程序博客网 时间:2024/05/24 05:01

1.下载压缩软件

版本选择:
mysql 5.6 密码:wvsx

2.解压缩

将mysql软件解压到指定的位置.

3.设置环境变量和添加path

设置MySQL环境变量:
MYSQL_HOME:D:\ProgramFiles\mysql-5.6.27-winx64
添加MySQL安装路径到Path中:
;%MYSQL_HOME%\bin

PS: 环境变量设置主要是在Path中可以引用环境变量,Path是程序运行时默认的搜寻路径.

4.设置安装或卸载服务:(cmd最好以管理员身份运行)

指定mysql的配置文件来安装mysql服务:`mysqld install MySQL --defaults-file="D:\ProgramFiles\MySQL\mysql-5.6.27-winx64\my-default.ini"` 注:my-default.ini文件在MySQL解压后的根目录下,如果没有,可从其他地方中获取。
# 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.[client]port=3306default-character-set=utf8[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 = .....# datadir = .....# port = .....# server_id = .....# define by yvesport=3306character_set_server=utf8basedir=D:\ProgramFiles\mysql-5.6.27-winx64#解压目录datadir=D:\ProgramFiles\mysql-5.6.27-winx64\data#解压目录下data目录,必须为data目录# 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 #########################################################[mysqld]sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES#########################################################

安装服务
mysqld -install

启动服务:
net start mysql

停止服务
net stop mysql

卸载服务
mysqld -remove

4.启动或停止MySQL

①通过mysql服务来启动mysql(前提是已经将mysql服务安装)
②直接运行mysql执行文件(如果是将mysql的安装路径添加到path中,可以直接通过命令行来启动mysql)

5. 修改 root 账号的密码

刚安装完成时root账号默认密码为空,此时可以将密码修改为指定的密码。如:123456
方法一:

c:>mysql –u rootmysql>show databases; mysql>use mysql;mysql>UPDATE user SET password=PASSWORD("123456") WHERE user='root';mysql>FLUSH PRIVILEGES;mysql>QUIT

方法二:
利用第三方管理工具进行密码修改。如Navicat for MySQL.

安装可能出现的问题:

问题1:错误信息:ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061)问题1解决办法:主要是删除了my-int配置文件.重新启动mysql.  注意:初始密码是空  而不是root

有关MySQL目录的操作:

  • 1.查看Mysql的安装目录:select @@basedir

参考链接:
http://www.jb51.net/article/86293.htm
https://www.cnblogs.com/jinjiangongzuoshi/p/3696904.html

原创粉丝点击