1. 安裝mysql
2. 在偏好設置中啟動 mysql 服務
3. 打開終端 輸入 mysql , 會發現
chenhong:~ chenhong$ mysql -bash: mysql: command not found
4. 設置mysql 命令,輸入
1)alias mysql=/usr/local/mysql/bin/mysql
2)alias mysqladmin=/usr/local/mysql/bin/mysqladmin
再次輸入 mysql 命令會發現
chenhong:~ chenhong$ mysql -bash: mysql: command not found chenhong:~ chenhong$ alias mysql=/usr/local/mysql/bin/mysql chenhong:~ chenhong$ alias mysqladmin=/usr/local/mysql/bin/mysqladmin chenhong:~ chenhong$ mysql Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 36 Server version: 5.1.63-log MySQL Community Server (GPL) Copyright (c) 2000, 2011, 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>
5. 使用數據庫 , 出現 mysql Access denied for user root@localhost錯誤
mysql Access denied for user root@localhost錯誤
$ mysql -u root -p
然後控制台會提示你輸入密碼
chenhong:~ chenhong$ mysql -u root -p Enter password:
輸入密碼後,就可以使用數據庫
mysql> use micro_message Database changed