本文記錄了linux mysql 8.0.18 安裝配置圖文教程,供大家參考,具體內(nèi)容如下
1、官網(wǎng)安裝包下載地址

2、我這里通過xftp將安裝包上傳至Linux服務(wù)器

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

繼續(xù)解壓需要的那一個
命令: 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下創(chuàng)建data文件夾
# mkdir data

5.初始化數(shù)據(jù)庫,自動生成密碼 需記錄 等下要用
# bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
ps:中間遇到一個坑,初始化數(shù)據(jù)庫時候報了錯
具體錯誤為: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這個東西 安裝就完事了
再次執(zhí)行初始化命令

得到初始化密碼,需要記下,一會會用到
6.修改/usr/local/mysql 當(dāng)前目錄的用戶
# chown -R root:root ./# chown -R mysql:mysql data
7.復(fù)制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
內(nèi)容:
[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/mysqldatadir = /usr/local/mysql/datasocket = /tmp/mysql.socklog-error = /usr/local/mysql/data/error.logpid-file = /usr/local/mysql/data/mysql.pidtmpdir = /tmpport = 5186#lower_case_table_names = 1# server_id = .....# socket = .....#lower_case_table_names = 1max_allowed_packet=32Mdefault-authentication-plugin = mysql_native_password#lower_case_file_system = on#lower_case_table_names = 1log_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
新聞熱點
疑難解答
圖片精選