mysql怎么初始化,mysql初始化沒反應(yīng)

如何初始化MySQL數(shù)據(jù)庫在Ubuntu安裝后

當(dāng)在Ubuntu中執(zhí)行命令sudo apt-get install mysql-server5.1安裝的時候居然沒有提示我輸入mysql的密碼之類的信息,但是當(dāng)安裝好之后再終端中直接輸入mysql的時候又能直接進(jìn)入mysql中,雖然可以進(jìn)入mysql中但是我對mysql的密碼一點(diǎn)都不知道,所以這個時候安裝的mysql就相當(dāng)于沒有安裝,因為不能用程序進(jìn)行操作mysql數(shù)據(jù)庫(因為操作數(shù)據(jù)庫都需要mysql數(shù)據(jù)的密碼的),為了解決ubuntu中mysql密碼初始化的方法有一下兩種:

成都創(chuàng)新互聯(lián)是一家專業(yè)提供濮陽企業(yè)網(wǎng)站建設(shè),專注與網(wǎng)站設(shè)計制作、網(wǎng)站設(shè)計、H5場景定制、小程序制作等業(yè)務(wù)。10年已為濮陽眾多企業(yè)、政府機(jī)構(gòu)等服務(wù)。創(chuàng)新互聯(lián)專業(yè)網(wǎng)站設(shè)計公司優(yōu)惠進(jìn)行中。

(1)打開/etc/mysql/debian.cnf文件,在這個文件中有系統(tǒng)默認(rèn)給我們分配的用戶名和密碼,通過這個密碼就可以直接對mysql進(jìn)行操作了。但是一般這個密碼都比較怪,很長很長。

(2)當(dāng)進(jìn)入mysql之后修改mysql的密碼:這個方法比較好,具體的操作如下用命令:set password for 'root'@'localhost' = password('yourpass');當(dāng)修改之后就可應(yīng)正常對mysql進(jìn)行操作了。

centos mysql 怎么初始化

使用的命令:mysql_install_db,用于初始化mysql的數(shù)據(jù)庫,生成元數(shù)據(jù)。

若不加任何參數(shù),則該命令按照/etc/my.cnf文件配置執(zhí)行初始化工作,否則可參照如下幫助手動執(zhí)行參數(shù)。

$ 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.

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

1、停止mysql服務(wù)

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

3、重啟myql即可

-----------------------------------

呵呵,放松,一切都會好起來的!

win10初始化mysql失敗?

mysql安裝步驟win10:

1、雙擊mysql-installer-community-5.7.20.0.msi安裝包;

2、勾選 Iaccept the license terms,點(diǎn)擊Next按鈕;

3、選擇Server only,點(diǎn)擊Next選項(因為我只想安裝個服務(wù)器端,所以選了這個選項。如果想安裝所有的,請選擇full選項,如果自定義安裝請選擇Custom選項);

4、點(diǎn)擊Execute選項執(zhí)行安裝;

5、安裝的過程中,在Progress列中可以看到安裝進(jìn)度;

6、status列變?yōu)镃omplete說明安裝完成,點(diǎn)擊Next按鈕;

7、點(diǎn)擊Next,進(jìn)行產(chǎn)品配置;

8、這個保持默認(rèn)選項,點(diǎn)擊Next;

9、選擇默認(rèn)選項,Development Machine選項會使用最小的內(nèi)存分配(因為是個人練習(xí)使用,所以不用占用太多電腦內(nèi)存),點(diǎn)擊Next;

10、設(shè)置root用戶的口令(我這里設(shè)置的比較簡單,所以提示密碼比較弱,從安全的角度說,大家還是應(yīng)該把密碼設(shè)置的復(fù)雜一點(diǎn)),點(diǎn)擊Next按鈕;

11、默認(rèn)配置,點(diǎn)擊Next按鈕;

12、插件和擴(kuò)展這保持默認(rèn)選項就好,點(diǎn)擊Next按鈕;

13、點(diǎn)擊Execute按鈕執(zhí)行配置;

14、看到所有都是對號,說明配置成功,點(diǎn)擊Finish按鈕;

15、再點(diǎn)擊Finish按鈕完成安裝;

16、點(diǎn)擊開始菜單中的MySQL 5.7 Command Line Client 客戶端;

17、輸入安裝時設(shè)置的root的口令,按下回車;

18、連接成功。

MySQL5.7數(shù)據(jù)庫怎么初始化

1、雙擊進(jìn)入安裝 2、在協(xié)議許可(License Agreement)界面,勾選“I accept the license terms”,點(diǎn)擊“Next”。 3、在檢查更新信息(Find latest products)界面,勾選“Skip the check for updates(no re中國mended)”跳過檢查,然后點(diǎn)擊“Next”。 4、在選擇安裝類型(Choosing a Setup Type)界面,根據(jù)安裝需求選擇安裝類型(推薦默認(rèn)開發(fā)版本),設(shè)置MySQL安裝路徑和數(shù)據(jù)存放路徑,最后點(diǎn)擊“Next”。 5、在檢查要求(Check Requirements)界面,點(diǎn)擊“Next”。 6、安裝進(jìn)度(Installation progress)界面,點(diǎn)擊“Execute”執(zhí)行。 7、等待安裝進(jìn)度完畢,點(diǎn)擊“Next”。 8、進(jìn)入配置概述(Configuration Overview)界面,點(diǎn)擊“Next”。 9、在MySQL服務(wù)配置(MySQL Server Configuration)界面,默認(rèn)不做修改,點(diǎn)擊“Next”。 10、設(shè)置根賬戶(root賬戶)密碼。 11、添加(非根)用戶賬戶。其目的是便于數(shù)據(jù)庫權(quán)限管理,為遠(yuǎn)程訪問者提供安全賬戶。

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

一、mysql_install_db說明

當(dāng)MySQL的系統(tǒng)庫(mysql系統(tǒng)庫)發(fā)生故障或需要新加一個mysql實(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ù)。

二、舉例:

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

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

#mkdir /data1/mysql_3308

#mkdir /data1/mysql_3308/data

#chown -R mysql:mysql /data1/mysql_3308

復(fù)制一個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ù)庫就初始化好了,如果有報錯,則按照報錯的提示查看報錯日志,一般情況下都是my.cnf配置文件的問題,修正后即可。

三、啟動新mysql

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

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

檢查是否啟動

#ps aux|grep mysql

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

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

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

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

文章名稱:mysql怎么初始化,mysql初始化沒反應(yīng)
網(wǎng)站URL:http://muchs.cn/article10/hcpsdo.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供全網(wǎng)營銷推廣、網(wǎng)站建設(shè)、服務(wù)器托管、響應(yīng)式網(wǎng)站、定制網(wǎng)站品牌網(wǎng)站建設(shè)

廣告

聲明:本網(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)

小程序開發(fā)