rpm -qa|grep mariadb
rpm -e --nodeps 檔名
tar Jxvf mysql-8.0.18-linux-glibc2.12-x86_64.tar.xz
mv mysql-8.0.18-linux-glibc2.12-x86_64 mysql
mv mysql /usr/local
mkdir /usr/local/mysql/data
vim /etc/my.cnf
[client]
port=3306
socket=/tmp/mysql.sock
[mysqld]
port=3306
user=mysql
socket=/tmp/mysql.sock
basedir=/usr/local/mysql
datadir=/usr/local/mysql/data
log-error=/usr/local/mysql/error.log
pid-file = /usr/local/mysql/mysql.pid
transaction_isolation = READ-COMMITTED
character-set-server = utf8mb4
collation-server = utf8mb4_general_ci
lower_case_table_names = 1
sql_mode = "STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION,NO_ZERO_DATE,NO_ZERO_IN_DATE,ERROR_FOR_DIVISION_BY_ZERO"
groupadd mysql
useradd -g mysql mysql
chown -R mysql:mysql /usr/local/mysql
chmod -R 755 /usr/local/mysql
cd /usr/local/mysql
./bin/mysqld --initialize --user=mysql
cd /usr/local/mysql
./support-files/mysql.server start
啟動成功則如下:
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql
cd /etc/init.d
chmod 755 /etc/init.d/mysql
chkconfig --add mysql
chkconfig --level 345 mysql on
service mysql restart
echo 'export MYSQL_HOME=/usr/local/mysql' >> /etc/profile
echo 'export PATH=.:$MYSQL_HOME/bin:$PATH' >> /etc/profile
source /etc/profile
在mysql目錄下有一個error.log的檔案,開啟可以看到預設密碼
mysql -uroot -p(預設密碼)
ALTER user 'root'@'localhost' IDENTIFIED BY '123456';
CREATE USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '123456';
GRANT ALL ON *.* TO 'root'@'%';
FLUSH PRIVILEGES;
以上操作完,可以去遠端使用者端登入存取