由于特殊需求,需要额外安装一个MySQLserver但是我的电脑上已经安装了一个MySQLserver了,怎么办呢?想到了在官网上下载免安装版本,免安装版本是一个zip文件,
mysql-5.6.36-winx64.zip
解压后就是我们熟知的MySQL目录:
现在问题来了,怎么使用?
首先肯定是需要先配置,将my-default.ini复制一份改名为my.ini
然后将如下内容粘贴至my.ini中并保存:
# The following options will be passed to all MySQL clients
[client]
# password = your_password
port = 3306
socket = "E:/soft/mysql5.6/mysql.sock"
# The MySQL server
[mysqld]
port= 3306
socket = "E:/soft/mysql5.6/mysql.sock"
basedir = "E:/soft/mysql5.6"
tmpdir = "E:/soft/mysql5.6/tmp"
datadir = "E:/soft/mysql5.6/data"
pid_file = "mysql.pid"
# enable-named-pipe
key_buffer = 16M
max_allowed_packet = 1M
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M
log_error = "mysql_error.log"
# Where do all the plugins live
plugin_dir = "E:/soft/mysql5.6/lib/plugin/"
server-id = 1
# Comment the following if you are using InnoDB tables
#skip-innodb
innodb_data_home_dir = "D:/xampp/mysql/data"
innodb_data_file_path = ibdata1:10M:autoextend
innodb_log_group_home_dir = "D:/xampp/mysql/data"
## You can set .._buffer_pool_size up to 50 - 80 %
## of RAM but beware of setting memory usage too high
innodb_buffer_pool_size = 16M
innodb_additional_mem_pool_size = 2M
## Set .._log_file_size to 25 % of buffer pool size
innodb_log_file_size = 5M
innodb_log_buffer_size = 8M
innodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout = 50
## UTF 8 Settings
init-connect=\'SET NAMES utf8\'
collation_server=utf8_unicode_ci
character_set_server=utf8
[mysqldump]
quick
max_allowed_packet = 16M
[mysql]
no-auto-rehash
# Remove the next comment character if you are not familiar with SQL
#safe-updates
[isamchk]
key_buffer = 20M
sort_buffer_size = 20M
read_buffer = 2M
write_buffer = 2M
[myisamchk]
key_buffer = 20M
sort_buffer_size = 20M
read_buffer = 2M
write_buffer = 2M
[mysqlhotcopy]
interactive-timeout
注意:上面的路径根据自己的解压路径而定
接下来注册mysql服务:
以管理员身份运行cmd.exe,然后进入mysql的bin目录,执行如下命令:
mysqld install mysql_java --defaults-file="E:\soft\mysql5.6\my.ini"
安装完成会有成功提示:
注意:my.ini就是上面修改过的my.ini
如果要删除服务:
mysqld remove mysql_java
接下来启动安装的mysql服务:
1.以管理员身份运行cmd.exe 执行: net start mysql_java
2.直接进入服务页面右键启动即可
剩下的就可操作普通MySQL一样的啦!
附:默认用户名:root 密码:空
如果想修改密码:
mysql>use mysql;
mysql>UPDATE user SET password=PASSWORD("123456") WHERE user='root';
mysql>FLUSH PRIVILEGES;
mysql>QUIT