当前位置 主页 > 服务器问题 > Linux/apache问题 > 最大化 缩小

    mysql 8.0.18 安装配置方法图文教程(linux)

    栏目:Linux/apache问题 时间:2019-11-10 15:13

    本文记录了linux mysql 8.0.18 安装配置图文教程,供大家参考,具体内容如下

    1、官网安装包下载地址

    2、我这里通过xftp将安装包上传至Linux服务器

    3.解压

    解压命令:tar -xvf mysql-8.0.18-linux-glibc2.12-x86_64.tar

    继续解压需要的那一个

    命令: tar -xvf mysql-8.0.18-linux-glibc2.12-x86_64.tar.xz

    重命名并移动到合适的路径

    重命名 : mv mysql-8.0.18-linux-glibc2.12-x86_64 mysql

    移动:


    4.在/usr/local/mysql下创建data文件夹

    # mkdir data

    5.初始化数据库,自动生成密码 需记录 等下要用

    # bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data

    ps:中间遇到一个坑,初始化数据库时候报了错

    具体错误为:bin/mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory

    解决方法为:yum install libaio-devel.x86_64 原因是缺少了libaio这个东西 安装就完事了

    再次执行初始化命令

    得到初始化密码,需要记下,一会会用到

    6.修改/usr/local/mysql 当前目录的用户

    # chown -R root:root ./
    # chown -R mysql:mysql data

    7.复制my-default.cnf这个文件到etc/my.cnf去

    具体命令为:

    # cd support-files/
    # touch my-default.cnf
    # chmod 777 ./my-default.cnf 
    # cd ../
    # cp support-files/my-default.cnf /etc/my.cnf

    8.完了之后配置my.cnf

    vim /etc/my.cnf

    内容:

    [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 = /usr/local/mysql
    datadir = /usr/local/mysql/data
    socket = /tmp/mysql.sock
    log-error = /usr/local/mysql/data/error.log
    pid-file = /usr/local/mysql/data/mysql.pid
    tmpdir = /tmp
    port = 5186
    #lower_case_table_names = 1
    # server_id = .....
    # socket = .....
    #lower_case_table_names = 1
    max_allowed_packet=32M
    default-authentication-plugin = mysql_native_password
    #lower_case_file_system = on
    #lower_case_table_names = 1
    log_bin_trust_function_creators = ON
    # 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
    
    下一篇:没有了