日本综合一区二区|亚洲中文天堂综合|日韩欧美自拍一区|男女精品天堂一区|欧美自拍第6页亚洲成人精品一区|亚洲黄色天堂一区二区成人|超碰91偷拍第一页|日韩av夜夜嗨中文字幕|久久蜜综合视频官网|精美人妻一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時(shí)間:8:30-17:00
你可能遇到了下面的問(wèn)題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營(yíng)銷解決方案
linuxmysql8安裝

在Linux系統(tǒng)中安裝MySQL 8,首先需要確保系統(tǒng)已經(jīng)安裝了必要的依賴庫(kù),以下是在基于Debian的系統(tǒng)(如Ubuntu)和基于RHEL的系統(tǒng)(如CentOS)中安裝MySQL 8的步驟:

創(chuàng)新互聯(lián)公司專注于企業(yè)網(wǎng)絡(luò)營(yíng)銷推廣、網(wǎng)站重做改版、安多網(wǎng)站定制設(shè)計(jì)、自適應(yīng)品牌網(wǎng)站建設(shè)、H5頁(yè)面制作、商城網(wǎng)站建設(shè)、集團(tuán)公司官網(wǎng)建設(shè)、外貿(mào)網(wǎng)站建設(shè)、高端網(wǎng)站制作、響應(yīng)式網(wǎng)頁(yè)設(shè)計(jì)等建站業(yè)務(wù),價(jià)格優(yōu)惠性價(jià)比高,為安多等各大城市提供網(wǎng)站開(kāi)發(fā)制作服務(wù)。

1. 更新系統(tǒng)并安裝依賴庫(kù)**

對(duì)于基于Debian的系統(tǒng):

sudo apt update
sudo apt upgrade
sudo apt install libaio1
sudo apt install cmake

對(duì)于基于RHEL的系統(tǒng):

sudo yum update
sudo yum install epel-release
sudo yum install libaio
sudo yum install cmake

2. 下載MySQL 8源碼**

訪問(wèn)MySQL官方網(wǎng)站()下載最新的MySQL 8源碼包,選擇適合你的系統(tǒng)的版本,然后復(fù)制下載鏈接。

以CentOS為例,使用wget命令下載:

wget https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.26.tar.gz

3. 解壓源碼包**

tar -zxvf mysql-8.0.26.tar.gz

4. 編譯并安裝MySQL 8**

進(jìn)入解壓后的目錄:

cd mysql-8.0.26

創(chuàng)建一個(gè)用于存放編譯結(jié)果的目錄:

mkdir build && cd build

使用CMake配置編譯選項(xiàng):

cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DWITH_BOOST=boost -DWITH_SYSTEMD=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DWITH_FEDERATED_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITH_MYISAM_STORAGE_ENGINE=1 -DENABLED_LOCAL_INFILE=1 -DENABLE_DTRACE=0 -DDEFAULT_CHARSET=utf8mb4 -DDEFAULT_COLLATION=utf8mb4_general_ci -DWITH_EMBEDDED_SERVER=OFF -DMYSQL_DATADIR=/usr/local/mysql/data -DSYSCONFDIR=/etc -DWITH_SSL=system -DWITH_ZLIB=bundled -DWITH_LIBWRAP=0 -DDEFAULT_AUTH_PLUGIN=mysql_native_password -DWITH_PARTITION_STORAGE_ENGINE=1 -DWITH_FEDERATED_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITH_MYISAM_STORAGE_ENGINE=1 -DENABLED_LOCAL_INFILE=1 -DENABLE_DTRACE=0 -DDEFAULT_CHARSET=utf8mb4 -DDEFAULT_COLLATION=utf8mb4_general_ci -DWITH_EMBEDDED_SERVER=OFF -DMYSQL_DATADIR=/usr/local/mysql/data -DSYSCONFDIR=/etc -DWITH_SSL=system -DWITH_ZLIB=bundled -DWITH_LIBWRAP=0 -DDEFAULT_AUTH_PLUGIN=mysql_native_password

編譯并安裝MySQL:

make && sudo make install

5. 將MySQL添加到環(huán)境變量**

編輯`~/.bashrc`文件,添加以下內(nèi)容:

export MYSQL_ROOTDIR=/usr/local/mysql/bin
export MYSQL_HOME=$MYSQL_ROOTDIR/mysql-8.0.26-linux-glibc2.12-x86_64
export PATH=$MYSQL_HOME:$PATH

保存文件后,執(zhí)行以下命令使更改生效:

source ~/.bashrc

6. 初始化數(shù)據(jù)庫(kù)**

“`bash

sudo mysqld –initialize –user=mysql –basedir=$MYSQL_HOME –datadir=$MYSQL_DATADIR –tmpdir=$MYSQLTMPDIR –console –skip-grant-tables &> init.out & echo “Waiting for confirmation of MySQL server startup” && sleep 60 && echo “MySQL Server started successfully” && ps | grep mysqld &> psout && killall mysqld &> killout && echo “MySQL Server stopped” && exit $? & wait $! && echo “MySQL Server exited with error code $?” && cat init.out > errors.log && cat psout > out.log && cat killout > killout.txt && exit $? || (cat errors.log >&2; exit $?) || (cat out.log >&2; exit $?) || (cat killout.txt >&2; exit $?) # If an error occurred, the first command will not complete so we need to use wait $! here instead of the last command which will not execute if an error occurred in the previous step of the script and will cause the script to exit immediately with a non zero status code without waiting for MySQL to start or report any errors that may have occurred during its startup process. The second command will redirect all output from the commands above to their respective log files and the third command will redirect any output remaining on the standard output stream to a file called killout.txt so that it can be viewed later using the `grep` command or by other means as needed. Finally, the exit status of the last command is returned to the caller of this script so that they can determine whether or not the MySQL server was able to start successfully or if there were any errors encountered during its startup process. If an error occurred, the exit status will be non zero otherwise it will be zero indicating success. If you prefer to return a different value to indicate success or failure, you can modify this script accordingly by changing the number at the end of the last line to something else like `exit $? &>&1`. You can also add additional error checking and logging as needed depending on your requirements for this script. ### Related Questions & Answers ### How do I check if MySQL is running on my system? You can use the following command to check if MySQL is running on your system: `ps | grep mysqld`. If the output includes a line that starts with `mysqld`, then MySQL is running on your system. ### How do I connect to a MySQL database using Python? You can use the `pymysql` library in Python to connect to a MySQL database as follows: `import pymysql conn = pymysql.connect(host=’localhost‘, user=’root’, password=’yourpassword’, db=’yourdatabase’) cursor = conn.cursor() cursor.execute(“SELECT * FROM yourtable”) results = cursor.fetchall() for row in results: print(row) conn.close()` Replace `localhost`, `root`, `yourpassword`, `yourdatabase`, and `yourtable` with your actual values for these parameters. ### How do I create a new user in MySQL? To create a new user in MySQL, you can use the following command: `CREATE USER ‘newuser’@’localhost’IDENTIFIED BY ‘password’;`. Replace `newuser`, `localhost`, and `password` with your desired values for these parameters. ### How do I grant privileges to a user in MySQL? To grant privileges to a user in MySQL, you can use the following command: `GRANT ALL PRIVILEGES ON databasename.* TO ‘username’@’localhost’;`. Replace `databasename`, `username`, and `localhost` with your desired values for these parameters. ### How do I delete a user in MySQL? To delete a user in MySQL, you can use the following command: `DROP USER ‘username’@’localhost’;`. Replace `username` and `localhost` with your desired values for these parameters
當(dāng)前名稱:linuxmysql8安裝
本文URL:http://www.dlmjj.cn/article/cdpiodh.html