安装和配置MySQL

作者: 老鼠不上树 | 来源:发表于2017-02-13 18:07 被阅读0次

    1.安装

    官网下载.zip文件解压。(mysql8.0.0版本)

    2.配置

    1.创建my.ini文件,复制my-default.ini文件的内容,根据需要修改默认配置文件

    # For advice on how to change settings please see

    # http://dev.mysql.com/doc/refman/8.0/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 = 500M #(Mysql数据缓存大小,根据自己内存大小跟需求调整)

    # 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 = D:\mysql\mysql8.0.0 #(Mysql目录路径)

    datadir = D:\mysql\mysql8.0.0\data #(Mysql库路径,默认是跟根录下data文件夹)

    port = 3306

    default-storage-engine = INNODB #(默认存储引擎)

    server_id = 11

    # 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

    2.安装mysql服务

    管理员身份运行命令行,切换到myql目录的安装目录下的bin目录,输入mysqld install回车运行

    3.初始化data文件夹

    将目录切换到解压文件的bin目录,运行 mysqld --initialize-insecure,如果安装目录中没有data文件夹,则新创建一个

    4.启动mysql服务

    在命令行中输入net start mysql启动mysql服务

    6.修改root密码

    运行 mysql -u root -p ,密码直接回车。进入后修改密码,mysql> ALTER USER'root'@'localhost'IDENTIFIED BY '你的密码'

    7.设置环境变量

    在path中设置好环境变量

    相关文章

      网友评论

        本文标题:安装和配置MySQL

        本文链接:https://www.haomeiwen.com/subject/mcuzittx.html