2018-11-17 回答
win7 64位下如何安装配置mysql-5.7.4-m14-winx64
1. mysql-5.7.4-m14-winx64.zip下载
2、解压到d:/mysql.(路径自己指定)
3、在d:/mysql/mysql-5.7.4-m14-winx64下新建my.ini配置文件
内容如下:
####################配置文件开始###################
# for advice on how to change settings please see
# *** 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]
default-character-set=utf8
[mysqld]
port=3306
basedir ="d:/mysql/mysql-5.7.4-m14-winx64/"
datadir ="d:/mysql/mysql-5.7.4-m14-winx64/data/"
tmpdir ="d:/mysql/mysql-5.7.4-m14-winx64/data/"
socket ="d:/mysql/mysql-5.7.4-m14-winx64/data/mysql.sock"
log-error="d:/mysql/mysql-5.7.4-m14-winx64/data/mysql_error.log"
#server_id = 2
#skip-locking
max_connections=100
table_open_cache=256
query_cache_size=1m
tmp_table_size=32m
thread_cache_size=8
innodb_data_home_dir="d:/mysql/mysql-5.7.4-m14-winx64/data/"
innodb_flush_log_at_trx_commit =1
innodb_log_buffer_size=128m
innodb_buffer_pool_size=128m
innodb_log_file_size=10m
innodb_thread_concurrency=16
innodb-autoextend-increment=1000
join_buffer_size = 128m
sort_buffer_size = 32m
read_rnd_buffer_size = 32m
max_allowed_packet = 32m
explicit_defaults_for_timestamp=true
sql-mode="strict_trans_tables,no_auto_create_user,no_engine_substitution"
#sql_mode=no_engine_substitution,strict_trans_tables
####################配置文件结束###################
重点是以下配置,其中datadir的目录名称必须是:d:/mysql/mysql-5.7.4-m14-winx64/data/。
4、在windows系统环境变量path,加入如下内容
d:/mysql/mysql-5.7.4-m14-winx64/bin;(注意加分号)
5、将mysql注册为windows系统服务
具体操作是在命令行中执行以下命令(需要以管理员身份运行命令行):
增加服务命令:mysqld install mysql --defaults-file="d:/mysql/mysql-5.7.4-m14-winx64/my.ini"
移除服务命令为:mysqld remove
6、第5步成功后,打开系统服务管理
可以看到mysql系统服务(此处需要注意):
需要在mysql服务的登陆属性里配置管理员用户登陆(不配置从服务管理里启动报1035错误,在命令行启动报启动失败)
在命令行启动mysql命令为: net start mysql
关闭mysql命令为:net stop mysql
7、修改root的密码为123456
命令行执行:mysql –uroot
mysql>show databases;
mysql>use mysql;
mysql> update user set password=password('123456') where user='root';
mysql> flush privileges;
mysql> quit
8、此时可以在本机上客户端连接了(本人用的是sqlyog),有个系统库叫:mysql
9、远程登陆配置
允许root用户在任何地方进行远程登录,并具有所有库任何操作权限,具体操作如下:
1)在本机先使用root用户登录mysql:
命令行执行:mysql -u root -p
输入密码(第7步中设置的密码):123456
2)进行授权操作:
mysql>grant all privileges on *.* to 'root'@'%' identified by 'youpassword' with grant option;
重载授权表:
mysql>flush privileges;
退出mysql:quit..。。。。