欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

MAC上安裝MYSQL的步驟是什么

這篇文章主要講解了“MAC上安裝MySQL的步驟是什么”,文中的講解內(nèi)容簡(jiǎn)單清晰,易于學(xué)習(xí)與理解,下面請(qǐng)大家跟著小編的思路慢慢深入,一起來(lái)研究和學(xué)習(xí)“MAC上安裝MYSQL的步驟是什么”吧!

鄱陽(yáng)網(wǎng)站建設(shè)公司成都創(chuàng)新互聯(lián)公司,鄱陽(yáng)網(wǎng)站設(shè)計(jì)制作,有大型網(wǎng)站制作公司豐富經(jīng)驗(yàn)。已為鄱陽(yáng)近1000家提供企業(yè)網(wǎng)站建設(shè)服務(wù)。企業(yè)網(wǎng)站搭建\外貿(mào)網(wǎng)站建設(shè)要多少錢(qián),請(qǐng)找那個(gè)售后服務(wù)好的鄱陽(yáng)做網(wǎng)站的公司定做!

下載地址:https://downloads.mysql.com/archives/community/

百度網(wǎng)盤(pán)下載:鏈接:https://pan.baidu.com/s/1nceFzJKK7_dJh3gUAtVgWw 密碼:qm5z

MAC上安裝MYSQL的步驟是什么

安裝

雙擊下載好的dmg文件,會(huì)彈出pkg彈框,再雙擊pkg圖標(biāo),進(jìn)入安裝界面,在安裝界面上一路繼續(xù),就安裝成功了。

環(huán)境變量

第一步,在終端切換到根目錄,編輯./.bash_profile文件

?  ~ cd ~
?  ~ vim ./.bash_profile

第二步,進(jìn)入vim編輯環(huán)境,按下i進(jìn)入insert模式,輸入

export PATH=$PATH:/usr/local/mysql/bin
export PATH=$PATH:/usr/local/mysql/support-files

第三步,按下 esc 退出 insert 模式,輸入 :wq 保存配置文件

:wq

第四步,在終端界面輸入以下命令,讓配置文件的修改生效,并查看環(huán)境變量是否設(shè)置成功

?  ~ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
?  ~ source ~/.bash_profile 
?  ~ echo $PATH            
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/mysql/bin:/usr/local/mysql/support-files
?  ~

MYSQL服務(wù)的啟停和狀態(tài)的查看

查看MYSQL的服務(wù)狀態(tài)

?  ~ sudo mysql.server status
Password:
 ERROR! MySQL is not running

啟動(dòng)MYSQL服務(wù)

?  ~ sudo mysql.server start 
Starting MySQL
.Logging to '/usr/local/mysql/data/mj.local.err'.
 SUCCESS!

停止MYSQL服務(wù)

?  ~ sudo mysql.server stop  
Shutting down MySQL
. SUCCESS!

重啟MYSQL服務(wù)

?  ~ sudo mysql.server restart
 ERROR! MySQL server PID file could not be found!
Starting MySQL
. SUCCESS!

啟動(dòng)

第一步,終端界面下輸入

?  ~ sudo mysql.server start 
Starting MySQL
.Logging to '/usr/local/mysql/data/mj.local.err'.
 SUCCESS!

第二步,啟動(dòng)MYSQL服務(wù),啟動(dòng)成功后繼續(xù)輸入

?  ~ mysql -u root -p

第三步,直接回車(chē),進(jìn)入數(shù)據(jù)庫(kù),看到以下歡迎界面

Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.41 MySQL Community Server (GPL)

Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.

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>

備注:默認(rèn)安裝成功后沒(méi)有初始密碼,所以密碼不用輸入,直接回車(chē)即可。

初始化設(shè)置

設(shè)置初始密碼,進(jìn)入mysql數(shù)據(jù)庫(kù)之后執(zhí)行下面的語(yǔ)句,設(shè)置當(dāng)前root用戶的密碼為root

?  ~ mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.6.41 MySQL Community Server (GPL)

Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.

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> set password = password('root');
Query OK, 0 rows affected (0.01 sec)

mysql>

退出MYSQL的界面

mysql> exit
Bye
?  ~

配置

進(jìn)入到 /usr/local/mysql/support-files目錄,里面有個(gè)文件my-default.cnf

?  ~ cd /usr/local/mysql/support-files
?  support-files ll
total 64
-rwxr-xr-x  1 root  wheel   1.1K  6 15  2018 binary-configure
-rw-r--r--  1 root  wheel   773B  6 15  2018 magic
-rw-r--r--  1 root  wheel   1.1K  6 15  2018 my-default.cnf
-rwxr-xr-x  1 root  wheel   894B  6 15  2018 mysql-log-rotate
-rwxr-xr-x  1 root  wheel    10K  6 15  2018 mysql.server
-rwxr-xr-x  1 root  wheel   1.0K  6 15  2018 mysqld_multi.server
?  support-files

將目錄下的my-default.cnf文件復(fù)制到桌面上,改名為my.cnf,

?  support-files ll
total 64
-rwxr-xr-x  1 root  wheel   1.1K  6 15  2018 binary-configure
-rw-r--r--  1 root  wheel   773B  6 15  2018 magic
-rw-r--r--  1 root  wheel   1.1K  6 15  2018 my-default.cnf
-rwxr-xr-x  1 root  wheel   894B  6 15  2018 mysql-log-rotate
-rwxr-xr-x  1 root  wheel    10K  6 15  2018 mysql.server
-rwxr-xr-x  1 root  wheel   1.0K  6 15  2018 mysqld_multi.server
?  support-files cp my-default.cnf /Users/a1/Desktop/my.cnf

將內(nèi)容替換為下面的內(nèi)容

[mysqld]
default-storage-engine=INNODB
character-set-server=utf8
port = 3306

[client]
default-character-set=utf8

將修改后的my.cnf文件復(fù)制到/etc目錄下,重啟MYSQL

?  /etc cp /Users/a1/Desktop/my.cnf ./
cp: ./my.cnf: Permission denied
?  /etc sudo cp /Users/a1/Desktop/my.cnf ./
Password:
?  /etc ll
total 1064
......
-rw-------   1 root  wheel   7.3K  2 29 14:10 master.passwd
-rw-r--r--   1 root  wheel   1.2K  5 17 17:24 my.cnf
-rw-r--r--   1 root  wheel    11B  2 29 14:43 nanorc
-rw-r--r--   1 root  wheel    53B  2 29 14:09 networks
......
?  /etc

備注:拷貝文件到etc目錄需要系統(tǒng)權(quán)限,因此需要在命令前加sudo

檢測(cè)修改結(jié)果

MAC上安裝MYSQL的步驟是什么

?  ~ mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.6.41 MySQL Community Server (GPL)

Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.

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> show variables like '%char%';
+--------------------------+-----------------------------------------------------------+
| Variable_name            | Value                                                     |
+--------------------------+-----------------------------------------------------------+
| character_set_client     | utf8                                                      |
| character_set_connection | utf8                                                      |
| character_set_database   | latin1                                                    |
| character_set_filesystem | binary                                                    |
| character_set_results    | utf8                                                      |
| character_set_server     | latin1                                                    |
| character_set_system     | utf8                                                      |
| character_sets_dir       | /usr/local/mysql-5.6.41-macos10.13-x86_64/share/charsets/ |
+--------------------------+-----------------------------------------------------------+
8 rows in set (0.01 sec)

mysql>

備注:此時(shí)不輸入密碼就登錄不了數(shù)據(jù)庫(kù)了,必須使用修改后的密碼登錄數(shù)據(jù)庫(kù)了,并且數(shù)據(jù)庫(kù)的字符集編碼信息已經(jīng)修改了。

感謝各位的閱讀,以上就是“MAC上安裝MYSQL的步驟是什么”的內(nèi)容了,經(jīng)過(guò)本文的學(xué)習(xí)后,相信大家對(duì)MAC上安裝MYSQL的步驟是什么這一問(wèn)題有了更深刻的體會(huì),具體使用情況還需要大家實(shí)踐驗(yàn)證。這里是創(chuàng)新互聯(lián),小編將為大家推送更多相關(guān)知識(shí)點(diǎn)的文章,歡迎關(guān)注!

分享標(biāo)題:MAC上安裝MYSQL的步驟是什么
文章分享:http://chinadenli.net/article20/gpieco.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供Google品牌網(wǎng)站制作網(wǎng)站導(dǎo)航建站公司定制開(kāi)發(fā)動(dòng)態(tài)網(wǎng)站

廣告

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

成都seo排名網(wǎng)站優(yōu)化