亚洲最大看欧美片,亚洲图揄拍自拍另类图片,欧美精品v国产精品v呦,日本在线精品视频免费

  • 站長資訊網(wǎng)
    最全最豐富的資訊網(wǎng)站

    步驟分明地教你在MAC上安裝MYSQL

    本篇文章帶大家簡析下MAC安裝MYSQL的方法,介紹一下MYSQL的一些知識,希望對大家有所幫助!

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

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

    步驟分明地教你在MAC上安裝MYSQL

    安裝

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

    環(huán)境變量

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

    ?  ~ cd ~ ?  ~ vim ./.bash_profile

    第二步,進入vim編輯環(huán)境,按下i進入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

    啟動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!

    啟動

    第一步,終端界面下輸入

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

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

    ?  ~ mysql -u root -p

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

    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>

    備注:默認安裝成功后沒有初始密碼,所以密碼不用輸入,直接回車即可。

    初始化設(shè)置

    設(shè)置初始密碼,進入mysql數(shù)據(jù)庫之后執(zhí)行下面的語句,設(shè)置當前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 ?  ~

    配置

    進入到 /usr/local/mysql/support-files目錄,里面有個文件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

    檢測修改結(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ù)據(jù)庫了,必須使用修改后的密碼登錄數(shù)據(jù)庫了,并且數(shù)據(jù)庫的字符集編碼信息已經(jīng)修改了。

    至此,就可以愉快的使用數(shù)據(jù)庫了?。。?/strong>

    推薦學(xué)習(xí):《mysql視頻教程》

    贊(0)
    分享到: 更多 (0)
    網(wǎng)站地圖   滬ICP備18035694號-2    滬公網(wǎng)安備31011702889846號