您的位置:首页 - 教程 - MYSQL - 正文
MySQL的安装与配置

1.下载安装包并解压(免安装);
2.在安装目录下添加my.ini文件,内容如下:

    ####################配置文件开始###################

 # For advice on how to change settings please see

 # http://dev.mysql.com/doc/refman/5.7/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]

 default-character-set=utf8

 

 [mysqld]

 port=3306

 basedir ="D:\mysql-5.7.12-winx64/"

 datadir ="D:\mysql-5.7.12-winx64/data/"

 tmpdir ="D:\mysql-5.7.12-winx64/data/"

 socket ="D:\mysql-5.7.12-winx64/data/mysql.sock"

 log-error="D:\mysql-5.7.12-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-5.7.12-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"
    skip-grant-tables
    #sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
####################配置文件结束###################

3.在windows系统环境变量path,加入如下内容
D:\mysql-5.7.12-winx64\bin
原理:环境变量里面的path路径就是cmd系统的查找目录路径。设置了以后就不需要再切换cmd路径了。
4.以管理员身份运行cmd.exe,进入安装目录\bin,并安装MySQL服务:
D:
cd mysql-5.7.12-winx64
cd bin
mysqld install
注:安装问题:“发生系统错误 193”
解决办法:D:\mysql-5.7.12-win64\bin 有个mysqld的空文件,删除即可。
5.初始化
mysqld --initialize
6.启动mysql:net start mysql
关闭mysql:net stop mysql
7.启动Mysql客户端程序,连接MYSQL服务器:
mysql -u root -p
******(密码)
8.在客户端程序上的操作:
(1)获取帮助:help
(2)获取服务器信息:\s
9.修改配置方式
直接修改my.ini即可。修改后需要重启MYSQL服务。


评论: