文章分类

相关文章

1.MySQL Community Server 5.7.25 安装

分类:MySql     发布:2019-01-25     来源:本站     浏览:431 次
1.下载并解压
下载:https://dev.mysql.com/downloads/mysql/5.7.html#downloads
解压:G:\01_java\06_mysql\mysql-5.7.25-winx64 (仅供参考)

2.配置系统环境变量
(1)新增系统变量  
变量名:MYSQL_HOME
变量值:Mysql解压目录,如 G:\01_java\06_mysql\mysql-5.7.25-winx64
(2)修改PATH变量,追加 ;%MYSQL_HOME%\bin; 

3.配置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]
 
# 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 = "G:\01_java\06_mysql\mysql-5.7.25-winx64"
 datadir = "G:\01_java\06_mysql\mysql-5.7.25-winx64\data"
 port = 3306
 character_set_server = utf8
 
# server_id = .....
  
# 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 
修改上面的basedir、datadir位置,如果data目录不存在,则在根目录新建一个名称为data的目录

4.管理员方式启动命令提示窗符
进入mysql解压目录到bin目录下
如:G:\01_java\06_mysql\mysql-5.7.25-winx64\bin
执行命令:
(1)初始化:mysqld -initialize-insecure
(2)安装:mysqld -install
提示:Service successfully installed.如提示Install/Remove of the Service Denied,说明不是已管理员的方式进入的命令提示符
此时在 控制面板->管理工具->服务 中可以看到MySQL的服务。
(3)启动服务:net start mysql
如果启动失败,可以去系统日志查看原因,执行: mysqld --initialize --user=mysql --console先执行以上命令, 生成库. 注意有个临时密码, 要记下来。
(4)使用临时密码登陆MySQL:mysql -u root -p 
输入上面生成的临时密码,就可以登录mysql了。
(5)修改root登录密码:set password = password('root');
此时root密码修改成功,可以通过mysql客户端进行连接了。


上一篇:Visual Studio Code 初学指南-1.安装和汉化

下一篇:Oracle查看表名称和表字段注释