mysql-8.0.16-linux-glibc2.12-x86_64


MySQL8數據庫安裝部署

  1. 准備
    卸載之前安裝過的版本
    確保之前安裝過的版本完全卸載,包括老版本使用的數據文件。檢查“/etc/my.cnf”,“/etc/mysql”,刪除。
    依賴庫 - libaio
    影響到數據目錄初始化、服務啟動。
  2. 安裝
    啟動MySQL的最簡單方法:
    groupadd mysql
    useradd -r -g mysql -s /bin/false mysql
    # jeecg項目需要忽略掉數據庫大小寫
    bin/mysqld --initialize --user=mysql --lower-case-table-names=1
    bin/mysqld_safe --user=mysql &
    # Next command is optional
    cp support-files/mysql.server /etc/init.d/mysql.server
    # reset password
    mysql -uroot -p
    alter user root@localhost identified by '';
    View Code

     

    為啟動腳本添加配置選項/etc/my.cnf:

    [mysqld]
    datadir=/usr/local/mysql/var
    socket=/var/tmp/mysql.sock
    port=3306
    user=mysql
    
    [mysql.server]
    basedir=/usr/local/mysql
    View Code

     

  3. 創建對象

    創建數據庫、創建用戶並授權

    create database if not exists db_name character set = utf8;
    create user user_name@'host_name' identified by 'user_pass';
    grant all privileges on db_name.* to 'user_name'@host_name;
    show grants for 'user_name'@host_name;
    View Code

    解決mysql2058

    alter user 'user_name'@'host_name' identified with mysql_native_password by 'user_pass';
    View Code

     

     

  4. 多實例運行
    選項:
    # Must have different values for each server instance.
    port=port_num
    socket={file_name|pipe_name}
    bind_address=0.0.0.0
    datadir=dir_name
    pid-file=file_name
    
    # log file options
    general_log_file=file_name
    log-bin[=file_name]
    slow_query_log_file=file_name
    log-error[=file_name]
    
    # To achieve better performance.
    tmpdir=dir_name
    View Code

     

 

 

 

 

MySQL5


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM