欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Centos8安裝mysql8的詳細(xì)過程(免安裝版/或者二進(jìn)制包方式安裝)

 更新時間:2022年11月08日 15:25:22   作者:chunchun868  
這篇文章主要介紹了Centos8安裝mysql8的詳細(xì)過程(免安裝版/或者二進(jìn)制包方式安裝),使用二進(jìn)制包方式安裝首先檢查服務(wù)器上是否安裝有mysql然后開始安裝配置,本文分步驟給大家講解的非常詳細(xì),需要的朋友可以參考下

二進(jìn)制包方式安裝

一、首先檢查服務(wù)器上是否安裝有mysql:

第一步:查看mysql安裝版本
rpm -qa|grep -i mysql

第二步:卸載Mysql
rpm -ev --nodeps 【上一步查詢到的mysql版本名稱】

最后刪除關(guān)于mysql相關(guān)的文件夾:查找根目錄下所有者是mysql和有mysql名稱的文件
find / -user mysql
find / -name mysql
把查找出的目錄文件刪除:rm -rf 路徑

二、開始安裝配置mysql

mysql-8.0.30-linux-glibc2.12-x86_64.tar.xz

網(wǎng)址:MySQL :: Download MySQL Community Server (Archived Versions)

上傳到服務(wù)器上,解壓,然后改名,copy到想要的安裝目錄(/usr/local/)

目錄計劃:

安裝目錄:/usr/local/mysql

data 目錄:/data/mysql/data/

日志位置:/data/mysql/mysql_error.err

xz -d  tar xvf mysql-8.0.30-linux-glibc2.12-x86_64.tar.xz
tar xvf mysql-8.0.30-linux-glibc2.12-x86_64.tar
mv mysql-8.0.30-linux-glibc2.12-x86_64 mysql
mv mysql /usr/local/

創(chuàng)建mysql用戶和用戶組

groupadd mysql
useradd -r -g mysql -s /bin/false mysql

將安裝目錄所有者及所屬組改為mysql ,并創(chuàng)建相關(guān)文件夾

cd /usr/local/
chown -R mysql:mysql /usr/local/mysql/
ll
mkdir -p /data/mysql/{data,backup,scripts,binlog}
ll /data/mysql/
chown -R mysql:mysql /data/mysql/

添加環(huán)境變量,并修改my.cnf配置文件

echo "export PATH=$PATH:/usr/local/mysql/bin"  >>  /etc/profile
source /etc/profile
vi /etc/my.cnf
[mysqld]
user=mysql
port=3306
#basedir=/data/mysql
datadir = /data/mysql/data/
default_authentication_plugin=mysql_native_password
log_error=/data/mysql/mysql_error.err
max_connections=10000
max_connect_errors=10
character-set-server=utf8mb4
default-storage-engine=INNODB
default_authentication_plugin=mysql_native_password
[mysql]
default-character-set=utf8mb4

初始化mysql數(shù)據(jù)庫

mysqld --initialize --user=mysql

/data/mysql/mysql_error.err里記錄了 mysql初始密碼

將mysql加入到服務(wù),并設(shè)置開機(jī)自啟,啟動mysql

cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
chkconfig mysqld on
systemctl start mysqld 

連接mysql

遇到報錯

[root@localhost mysql]# mysql -uroot -p
mysql: error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such file or directory

解決方案:

[root@localhost mysql]# sudo ln -s /usr/lib64/libtinfo.so.6.1 /usr/lib64/libtinfo.so.5

再次連接SQL

[root@localhost mysql]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.30

Copyright (c) 2000, 2022, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
# 修改初始密碼
mysql> alter user root@localhost identified by '111111';
Query OK, 0 rows affected (0.00 sec)
mysql> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed#設(shè)置遠(yuǎn)程連接
mysql> update user set host='%' where user='root';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0
# 刷新權(quán)限
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
# 賦權(quán)限
mysql> grant all privileges on *.* to 'root'@'%' with grant option;
Query OK, 0 rows affected (0.00 sec)#刷新權(quán)限
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
mysql> quit

#刷新權(quán)限

systemctl restart mysql
or
service mysql restart

重啟服務(wù)且測試

systemctl restart mysqlorservice mysql restart

查看防火墻開放端口

  firewall-cmd --list-all

在防火墻中將3306端口開放

  firewall-cmd --zone=public --add-port=3306/tcp --permanent

  firewall-cmd --reload

  //--permanent為永久生效,沒有此參數(shù) 服務(wù)器重啟后配置失效

在Navicat上測試連接

重啟linux后測試自啟動(可選)
  reboot

測試mysql服務(wù)是否自啟動

  systemctl status mysql

參考文獻(xiàn):

(1條消息) Linux下免安裝版本的mysql5.7

到此這篇關(guān)于Centos8安裝mysql8的詳細(xì)過程(免安裝版/或者二進(jìn)制包方式安裝)的文章就介紹到這了,更多相關(guān)Centos8上安裝mysql8內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

  • MySQL全文索引實現(xiàn)簡單版搜索引擎實例代碼

    MySQL全文索引實現(xiàn)簡單版搜索引擎實例代碼

    這篇文章主要給大家介紹了關(guān)于MySQL全文索引實現(xiàn)簡單版搜索引擎的相關(guān)資料,文中通過示例代碼介紹的非常詳細(xì),對大家學(xué)習(xí)或者使用MySQL具有一定的參考學(xué)習(xí)價值,需要的朋友們下面來一起學(xué)習(xí)學(xué)習(xí)吧
    2019-07-07
  • MySQL多表查詢的案例詳解

    MySQL多表查詢的案例詳解

    這篇文章主要介紹了MySQL多表查詢的案例說明,包括多表查詢的分類及umion的使用,本文給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下
    2022-03-03
  • mysql 5.6 從陌生到熟練之_數(shù)據(jù)庫備份恢復(fù)的實現(xiàn)方法

    mysql 5.6 從陌生到熟練之_數(shù)據(jù)庫備份恢復(fù)的實現(xiàn)方法

    下面小編就為大家?guī)硪黄猰ysql 5.6 從陌生到熟練之_數(shù)據(jù)庫備份恢復(fù)的實現(xiàn)方法。小編覺得挺不錯的,現(xiàn)在就分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2016-10-10
  • MySQL查詢條件中in會用到索引嗎

    MySQL查詢條件中in會用到索引嗎

    這篇文章主要給大家介紹了MySQL查詢條件中in會不會用到索引的相關(guān)資料,文中通過示例代碼介紹的非常詳細(xì),對大家學(xué)習(xí)或者使用MySQL具有一定的參考學(xué)習(xí)價值,需要的朋友們下面來一起學(xué)習(xí)學(xué)習(xí)吧
    2019-07-07
  • The MySQL server is running with the --read-only option so it cannot execute this statement

    The MySQL server is running with the --read-only option so i

    1209 - The MySQL server is running with the --read-only option so it cannot execute this statement
    2020-08-08
  • MYSQL突破secure_file_priv寫shell問題

    MYSQL突破secure_file_priv寫shell問題

    這篇文章主要介紹了MYSQL突破secure_file_priv寫shell問題,具有很好的參考價值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教
    2024-01-01
  • windows server2016安裝MySQL5.7.19解壓縮版教程詳解

    windows server2016安裝MySQL5.7.19解壓縮版教程詳解

    本篇文章給大家記錄了MySQL 5.7.19 winx64解壓縮版安裝教程,非常不錯,具有參考借鑒價值,需要的的朋友參考下吧
    2017-08-08
  • Mybatis報錯: org.apache.ibatis.exceptions.PersistenceException解決辦法

    Mybatis報錯: org.apache.ibatis.exceptions.PersistenceException

    這篇文章主要介紹了Mybatis報錯: org.apache.ibatis.exceptions.PersistenceException解決辦法的相關(guān)資料,需要的朋友可以參考下
    2016-12-12
  • MySQL的分區(qū)表使用場景及示例小結(jié)

    MySQL的分區(qū)表使用場景及示例小結(jié)

    MySQL的分區(qū)表功能在某些場景下可以顯著提高查詢效率,本文主要介紹了MySQL的分區(qū)表使用場景及示例小結(jié),具有一定的參考價值,感興趣的可以了解一下
    2024-06-06
  • MySQL更新存放JSON的字段、\“ 轉(zhuǎn)義成 “的問題描述

    MySQL更新存放JSON的字段、\“ 轉(zhuǎn)義成 “的問題描述

    本篇介紹在執(zhí)行MySQL線上變更時遇到的問題,表現(xiàn)為"更新JSON字段時,實際更新的值與SQL語句中的值不一致,JSON格式錯誤",本文給大家分享問題描述及解決方案,感興趣的朋友一起看看吧
    2022-12-12

最新評論