成人午夜视频全免费观看高清-秋霞福利视频一区二区三区-国产精品久久久久电影小说-亚洲不卡区三一区三区一区

mysql數(shù)據(jù)庫安裝和修改默認(rèn)存儲路徑的方法

這篇文章主要介紹“MySQL數(shù)據(jù)庫安裝和修改默認(rèn)存儲路徑的方法”,在日常操作中,相信很多人在mysql數(shù)據(jù)庫安裝和修改默認(rèn)存儲路徑的方法問題上存在疑惑,小編查閱了各式資料,整理出簡單好用的操作方法,希望對大家解答”mysql數(shù)據(jù)庫安裝和修改默認(rèn)存儲路徑的方法”的疑惑有所幫助!接下來,請跟著小編一起來學(xué)習(xí)吧!

創(chuàng)新互聯(lián)建站聯(lián)系電話:13518219792,為您提供成都網(wǎng)站建設(shè)網(wǎng)頁設(shè)計(jì)及定制高端網(wǎng)站建設(shè)服務(wù),創(chuàng)新互聯(lián)建站網(wǎng)頁制作領(lǐng)域10多年,包括發(fā)電機(jī)維修等多個領(lǐng)域擁有多年建站經(jīng)驗(yàn),選擇創(chuàng)新互聯(lián)建站,為企業(yè)錦上添花。

1、mysql數(shù)據(jù)庫安裝

[root@zrbapp ~]# 

[root@zrbapp ~]# ll /soft/mysql_software/

total 196380

-rw-r--r-- 1 root root  25402568 Oct 31 23:51 mysql-community-client-5.7.25-1.el7.x86_64.rpm

-rw-r--r-- 1 root root    280904 Oct 31 23:51 mysql-community-common-5.7.25-1.el7.x86_64.rpm

-rw-r--r-- 1 root root   2271668 Oct 31 23:51 mysql-community-libs-5.7.25-1.el7.x86_64.rpm

-rw-r--r-- 1 root root 173130520 Oct 31 23:52 mysql-community-server-5.7.25-1.el7.x86_64.rpm

drwxr-xr-x 2 root root       245 Oct 31 23:52 tool

[root@zrbapp ~]# 

[root@zrbapp ~]# rpm -ivh /soft/mysql_software/*.rpm

warning: /soft/mysql_software/mysql-community-client-5.7.25-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY

Preparing...                          ################################# [100%]

Updating / installing...

   1:mysql-community-common-5.7.25-1.e################################# [ 25%]

   2:mysql-community-libs-5.7.25-1.el7################################# [ 50%]

   3:mysql-community-client-5.7.25-1.e################################# [ 75%]

   4:mysql-community-server-5.7.25-1.e################################# [100%]

[root@zrbapp ~]# 

[root@zrbapp ~]# systemctl start mysqld

[root@zrbapp ~]# 

[root@zrbapp ~]# systemctl status mysqld

● mysqld.service - MySQL Server

   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)

   Active: active (running) since Fri 2019-11-01 04:36:09 CST; 17s ago

     Docs: man:mysqld(8)

           http://dev.mysql.com/doc/refman/en/using-systemd.html

  Process: 10148 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=0/SUCCESS)

  Process: 10074 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)

 Main PID: 10151 (mysqld)

   CGroup: /system.slice/mysqld.service

           └─10151 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid

Nov 01 04:35:50 zrbapp02 systemd[1]: Starting MySQL Server...

Nov 01 04:36:09 zrbapp02 systemd[1]: Started MySQL Server.

[root@zrbapp ~]# 

[root@zrbapp ~]# 

2、修改mysql數(shù)據(jù)庫默認(rèn)路徑

[root@zrbapp mysql]# 

[root@zrbapp mysql]# cat /etc/my.cnf

# For advice on how to change settings please see

# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html

[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

#

# 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

datadir=/var/lib/mysql                     ----修改默認(rèn)路徑到指定位置

socket=/var/lib/mysql/mysql.sock

# Disabling symbolic-links is recommended to prevent assorted security risks

symbolic-links=0

log-error=/var/log/mysqld.log

pid-file=/var/run/mysqld/mysqld.pid

[root@zrbapp mysql]# 

2.1 停止mysql數(shù)據(jù)

[root@zrbapp mysql]# systemctl stop mysqld

2.2 將mysql數(shù)據(jù)庫打包

[root@zrbapp mysql]#   cd /var/lib

[root@zrbapp mysql]#  tar -cvf mysql.tar mysql

[root@zrbapp mysql]# ll /var/lib/mysql.tar 

-rw-r--r-- 1 root root 126791680 Nov  1 06:03 /var/lib/mysql.tar

[root@zrbapp mysql]# 

2.3 創(chuàng)建mysql數(shù)據(jù)庫目標(biāo)存儲路徑并賦屬組權(quán)限

[root@zrbapp mysql]# mkdir -p /mysqldb

[root@zrbapp mysql]# chown -R mysql:mysql /mysqldb

[root@zrbapp mysql]# chown -R 755 /mysqldb

2.4 將打包好的mysql數(shù)據(jù)庫移動到目標(biāo)存儲路徑(mysqldb)

[root@zrbapp mysql]# mv /var/lib/mysql.tar /mysqldb

2.5 進(jìn)入目標(biāo)存儲路徑解壓mysql數(shù)據(jù)庫

[root@zrbapp mysql]# cd /mysqldb

[root@zrbapp mysql]# tar -xvf mysqldb.tar

2.6 修改mysql數(shù)據(jù)庫配置文件my.cnf

[root@zrbapp mysql]# vi /etc/my.cnf

# For advice on how to change settings please see

# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html

[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

#

# 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

#datadir=/var/lib/mysql    ----注銷掉原來mysql數(shù)據(jù)庫路徑

datadir=/mysqldb/mysql   ----增加目標(biāo)mysql數(shù)據(jù)庫路徑

#socket=/mysqldb/mysql/mysql.sock  

#socket路徑若修改則在刪除/var/lib/mysql數(shù)據(jù)時則不用考慮保留mysql.sock文件,本例保持默認(rèn)!

socket=/var/lib/mysql/mysql.sock   

#socket路徑可以保持不變,但注意在刪除/var/lib/mysql目錄的mysql的文件時則需要保留mysql.sock文件,否則導(dǎo)致數(shù)據(jù)庫啟動失??; 

# Disabling symbolic-links is recommended to prevent assorted security risks

symbolic-links=0

log-error=/var/log/mysqld.log

pid-file=/var/run/mysqld/mysqld.pid

wq!   ----并保存退出即可

刪除/var/lib/mysql目錄下除mysql.sock和mysql.sock.lock以外的所有文件,當(dāng)前也可以選擇不刪除不影響

[root@zrbapp mysql]# ls

auto.cnf    ca.pem           client-key.pem  ibdata1      ib_logfile1  mysql.sock      performance_schema  public_key.pem   server-key.pem

ca-key.pem  client-cert.pem  ib_buffer_pool  ib_logfile0  mysql        mysql.sock.lock  private_key.pem     server-cert.pem  sys

[root@zrbapp mysql]# 

2.7 啟動數(shù)據(jù)庫并查看狀態(tài)

[root@zrbapp mysql]# 

[root@zrbapp mysql]# systemctl start mysqld

[root@zrbapp mysql]# 

[root@zrbapp mysql]# systemctl status mysqld

● mysqld.service - MySQL Server

   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)

   Active: active (running)since Fri 2019-11-01 06:20:36 CST; 6s ago     ----數(shù)據(jù)庫啟動正常; 

     Docs: man:mysqld(8)

           http://dev.mysql.com/doc/refman/en/using-systemd.html

  Process: 10348 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=0/SUCCESS)

  Process: 10331 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)

 Main PID: 10351 (mysqld)

   CGroup: /system.slice/mysqld.service

           └─10351 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid

Nov 01 06:20:33 zrbapp systemd[1]: Starting MySQL Server...

Nov 01 06:20:36 zrbapp systemd[1]: Started MySQL Server.

[root@zrbapp mysql]# 

[root@zrbapp mysql]# 

到此,關(guān)于“mysql數(shù)據(jù)庫安裝和修改默認(rèn)存儲路徑的方法”的學(xué)習(xí)就結(jié)束了,希望能夠解決大家的疑惑。理論與實(shí)踐的搭配能更好的幫助大家學(xué)習(xí),快去試試吧!若想繼續(xù)學(xué)習(xí)更多相關(guān)知識,請繼續(xù)關(guān)注創(chuàng)新互聯(lián)網(wǎng)站,小編會繼續(xù)努力為大家?guī)砀鄬?shí)用的文章!

網(wǎng)站題目:mysql數(shù)據(jù)庫安裝和修改默認(rèn)存儲路徑的方法
URL網(wǎng)址:http://jinyejixie.com/article26/ipidcg.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供ChatGPT移動網(wǎng)站建設(shè)、云服務(wù)器企業(yè)建站、App設(shè)計(jì)、網(wǎng)站排名

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

成都定制網(wǎng)站網(wǎng)頁設(shè)計(jì)
天柱县| 博湖县| 南澳县| 砚山县| 庆城县| 沙洋县| 阜新市| 河池市| 余江县| 潞西市| 茌平县| 蒙自县| 西青区| 新兴县| 迭部县| 安新县| 汾西县| 抚远县| 宿迁市| 咸宁市| 泸溪县| 宜章县| 大新县| 曲阜市| 衡山县| 平乐县| 滨州市| 呼和浩特市| 修武县| 南昌县| 二连浩特市| 南昌市| 定州市| 平南县| 如东县| 嘉黎县| 龙游县| 靖边县| 襄城县| 修文县| 扎兰屯市|