真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

怎么初始化mysql 怎么初始化硬盤

如何初始化mysql數(shù)據(jù)

一、mysql_install_db說明

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

當(dāng)MySQL的系統(tǒng)庫(mysql系統(tǒng)庫)發(fā)生故障或需要新加一個(gè)mysql實(shí)例時(shí),需要初始化mysql數(shù)據(jù)庫。

需要使用的命令:/usr/local/mysql/bin/mysql_install_db

#/usr/local/mysql/bin/mysql_install_db --help 可以查看幫助信息如下

Usage: /usr/local/mysql/bin/mysql_install_db [OPTIONS]

--basedir=path The path to the MySQL installation directory.

--cross-bootstrap For internal use. Used when building the MySQL system

tables on a different host than the target.

--datadir=path The path to the MySQL data directory.

--force Causes mysql_install_db to run even if DNS does not

work. In that case, grant table entries that normally

use hostnames will use IP addresses.

--ldata=path The path to the MySQL data directory.

--rpm For internal use. This option is used by RPM files

during the MySQL installation process.

--skip-name-resolve Use IP addresses rather than hostnames when creating

grant table entries. This option can be useful if

your DNS does not work.

--srcdir=path For internal use. The directory under which

mysql_install_db looks for support files such as the

error message file and the file for popoulating the

help tables.

--user=user_name The login username to use for running mysqld. Files

and directories created by mysqld will be owned by this

user. You must be root to use this option. By default

mysqld runs using your current login name and files and

directories that it creates will be owned by you.

All other options are passed to the mysqld program

除了支持以上的參數(shù),還支持mysqld的參數(shù)。

二、舉例:

本文以新加一個(gè)mysql實(shí)例為例。例如服務(wù)器上已經(jīng)安裝了3306端口的mysql服務(wù),需要再啟一個(gè)3308端口的mysql服務(wù)。

假設(shè)mysql安裝在/usr/local/mysql路徑下,找一個(gè)磁盤空間剩余比較大的盤,如/data1,把3308端口的mysql的數(shù)據(jù)保存在/data1下

#mkdir /data1/mysql_3308

#mkdir /data1/mysql_3308/data

#chown -R mysql:mysql /data1/mysql_3308

復(fù)制一個(gè)mysql配置文件my.cnf到/data1/mysql_3308目錄下

#vi /data1/mysql_3308/my.cnf

修改配置文件,將端口和相關(guān)目錄的都改為新的設(shè)置,如下:

[client]

character-set-server = utf8

port = 3308

socket = /tmp/mysql_3308.sock

[mysqld]

user = mysql

port = 3308

socket = /tmp/mysql_3308.sock

basedir = /usr/local/mysql

datadir = /data1/mysql_3308/data

log-error = /data1/mysql_3308/mysql_error.log

pid-file = /data1/mysql_3308/mysql.pid

......其他略

確保配置文件無誤。

運(yùn)行下面命令進(jìn)行數(shù)據(jù)庫的初始化:

#/usr/local/mysql/bin/mysql_install_db --defaults-file=/data1/mysql_3308/my.cnf --datadir=/data1/mysql_3308/data

完成后新的3308數(shù)據(jù)庫就初始化好了,如果有報(bào)錯(cuò),則按照報(bào)錯(cuò)的提示查看報(bào)錯(cuò)日志,一般情況下都是my.cnf配置文件的問題,修正后即可。

三、啟動(dòng)新mysql

啟動(dòng)3308端口的mysql服務(wù)

#/usr/local/mysql/bin/mysqld_safe --defaults-file=/data1/mysql_3309/my.cnf

檢查是否啟動(dòng)

#ps aux|grep mysql

如果有3308字樣說明已經(jīng)啟動(dòng)成功

可將啟動(dòng)命令加入/etc/rc.local隨服務(wù)器啟動(dòng)

新加的mysql沒有設(shè)置root密碼,可以通過下面命令設(shè)置root密碼:

#/usr/local/mysql/bin/mysqladmin -S /tmp/mysql_3308.sock -u root password 'new-password'

如何初始化MySQL數(shù)據(jù)庫

1、停止mysql服務(wù)

2、刪除mysql的data目錄下的,除mysql這個(gè)目錄外的其他目錄(為保險(xiǎn)期間,先移走)

3、重啟myql即可

sql數(shù)據(jù)庫數(shù)據(jù)如何初始化

初始化mysql數(shù)據(jù)庫,在shell中運(yùn)行以下命令:

cd /usr/local/mysql

mkdir sock

cd /usr/local/mysql/bin

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

./mysql_install_db--user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data

或者# mysqld --initialize


當(dāng)前題目:怎么初始化mysql 怎么初始化硬盤
網(wǎng)頁地址:http://weahome.cn/article/dosjgod.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部