mac下安裝mysql,mac安裝mysql

來源:互聯網
上載者:User

mac下安裝mysql,mac安裝mysql
安裝mysql及檢查

1.mysql官網下載dmg安裝包

2.下載完成後,雙擊安裝包,一步一步點下去就行,預設是標準安裝,最後在安裝完成之前也可以“自訂”安裝

3.在終端輸入 mysql  --version 會提示command not found

 解決方案是,運行以下兩條命令:
cd /usr/local/bin/
sudo ln -fs /usr/local/mysql/bin/mysql mysql
4.此時輸入mysql --version  列印出mysql版本


啟動mysql(開啟安全模式啟動mysql):


1. sudo /usr/local/mysql/bin/mysqld_safe --skip-grant-tables

2. 在終端的另一個頁簽中   輸入命令
ps -ef|grep mysql 

localhost:bin fujunmin$ ps -ef|grep mysql

可以看到,mysql服務已經啟動

3.進入mysql
mysql -u root 
直接跳過輸入密碼,直接斷行符號就進入了mysql

# mysql預設密碼是root,但是如果在代碼中串連的話,會發現串連不上,mysql需要我們修改密碼,修改密碼的命令:

mysql>update mysql.user set password=PASSWORD('新密碼') where User='root'; 

4. 停止mysql服務:

sudo /usr/local/mysql/support-files/mysql.server stop
終止服務的時候,會讓輸入密碼,輸入修改後的密碼即可
localhost:~ fujunmin$ sudo /usr/local/mysql/support-files/mysql.server stop

localhost:~ fujunmin$ sudo /usr/local/mysql/support-files/mysql.server start



查看評論

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.