您的位置:首页 > 数据库

JDBC连接数据库总结

2011-11-28 17:40 330 查看
1.先进行mysql-5.6.15-winx64.zip 绿色版文件进行解压

2.配置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 = .....
# datadir = .....
# port = .....
# server_id = .....

basedir=D:/mysql-5.6.15-winx64
datadir=D:/mysql-5.6.15-winx64/data
port=3306
server_id=10

# 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

 

3.把mysql 添加到windows 服务中

首先进入到mysql解压的bin目录,然后执行

 mysqld --install MySQL --defaults-file="C:\Windows\my.ini"

4.启动mysql服务

在命令窗中输入 services.msc 找到MySQL 右键启动

或者直接执行 net start mysql  

其他命令  net stop mysql  mysqld -remove 移除服务

5.添加环境变量

把解压的mysql bin 目录添加到环境变量的path 目录中

6.登陆数据库

在命令窗口中输入 mysql -u root -p  初次密码为空

7.修改mysql 密码

mysql>use mysql;

mysql>update user set Password=password('newpassword') where User='root';

mysql>flush privileges;

 

 

注意:安装mysql 如果出现错误,请仔细检查ini文件。如果服务名称已存在 请用  sc  delete mysql 删除服务

 

 

 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: