Linux Mysql 8.0.1
下載相應的mysql安裝包後
cp /home/hdkg/soft/mysql-8.0.11-linux-glibc2.12-x86_64.tar/usr/local/
tar xvf mysql-8.0.11-linux-glibc2.12-x86_64.tar
tar zxvf mysql-8.0.11-linux-glibc2.12-x86_64.tar.gz
mv mysql-8.0.11-linux-glibc2.12-x86_64mysql
新增使用者和組
groupadd mysql
useradd -g mysql mysql
cd /usr/local/mysql/
mkdir /data/
chown -R mysql:mysql .
cp /home/hdkg/soft/my.cnf /etc/my.cnf
如果/etc/my.cnf之前存在,就不拷貝了,沒有就自己建立一個吧 ,修改其中
[mysqld]
lower_case_table_names=1
event_scheduler=1
max_connections=500
Datadir=/usr/local/mysql/data
Basedir=/usr/local/mysql
socket = /usr/local/mysql/data/mysql.sock
[client]
socket = /usr/local/mysql/data/mysql.sock
儲存my.cnf
/bin/mysqld--defaults-file=/etc/my.cnf –initialize
有初始化密碼
或者
/bin/mysqld--defaults-file=/etc/my.cnf --initialize-insecure
無初始密碼建議這個
我們執行下面這個沒有初始密碼的
bin/mysqld --initialize-insecure --user=mysql--basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
然後
bin/mysql_ssl_rsa_setup --datadir=/usr/local/mysql/data
然後
Cp -r /bin/support-files/mysql.server /etc/init.d/mysqld
然後
service mysqld start
然後
service mysqld status
然後
vi /etc/profile
前面追加客戶端的位置
export PATH=/usr/local/mysql/bin:$PATH
然後
source /etc/profile
然後
mysql -uroot -p
回車
根據前面的操作,有密碼輸入密碼,沒有直接回車
11
配置mysql自動啟動
# chmod 755 /etc/init.d/mysqld
# chkconfig --add mysqld
# chkconfig --level 345 mysqld on
建立使用者及修改 root使用者許可權:
use mysql;
CREATE USER 'test'@'%' IDENTIFIEDWITH mysql_native_password BY 'test2007';
flush privileges;
grant all on *.* to 'test'@'%' WITH GRANT OPTION;
flush privileges;
alter user 'root'@'localhost' identified with mysql_native_password by'root';
flush privileges;
update user set host=’%’where user=’root’;
flush privileges’
下面是my.cnf檔案 樣例 紅色部分引數是為了解決,客戶端還停留在5.6.x-5.7.x版本 密碼驗證的問題。還有字符集的問題。
my.cnf 檔案基本內容(紅色部分為要新增部分)
# For advice on how to change settingsplease see
#http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html
# *** DO NOT EDIT THIS FILE. It's atemplate which will be copied to the
# *** default location during install, andwill be replaced if you
# *** upgrade to a newer version of MySQL.
[client]
socket = /usr/local/mysql/data/mysql.sock
[mysqld]
lower_case_table_names=1
event_scheduler=1
max_connections=500
default_authentication_plugin=mysql_native_password
slow_query_log = ON
slow_query_log_file =/usr/local/mysql/data/slow.log
long_query_time = 1
character_set_server=utf8
skip-host-cache
skip-name-resolve
# Remove leading # and set to the amount ofRAM for the most important data
# cache in MySQL. Start at 70% of total RAMfor dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
# Remove leading # to turn on a veryimportant data integrity option: logging
# changes to the binary log betweenbackups.
# log_bin
log_bin=/usr/local/mysql/mysql-bin
# These are commonly set, remove the # andset as required.
basedir = /usr/local/mysql/
datadir = /usr/local/mysql/data/
# port = .....
server_id = 178
#socket = /var/lib/mysql/mysql.sock
socket = /usr/local/mysql/data/mysql.sock
# Remove leading # to set options mainly usefulfor reporting servers.
# The server defaults are faster fortransactions and fast SELECTs.
# Adjust sizes as needed, experiment tofind the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
解決客戶端沒有8.0 加密外掛方案
[mysqld]
default_authentication_plugin=mysql_native_password
下面是grep 查詢高亮顯示
可以通過設定GREP_OPTIONS 為'--color=auto'來自動為匹配部分著色也可以通過設定GREP_COLOR的值來指定顏色下面是部分顏色的值
30 black
31 red
32 green
33 yellow
34 blue
35 purple
36 cyan
37 white