標籤:
今天開始安裝MySQL,本來是去官網下載安裝包來安裝的,但是安裝之後卻不能用,預計是要配置吧,在網上搜了非常多的資料,結果還是失敗。所以僅僅好在軟體源中安裝,這樣就省去非常多不必要的麻煩了。
[email protected]:~$ sudo apt-get install mysql-server[sudo] password for zhiniaobu:
運行該命令後,系統還會自己主動安裝其他的一些軟體,在安裝過程中會提示輸入mysql的登入password。
假設系統版本號碼不一樣,提示的方式可能不一樣,只是整體來說都差點兒相同。安裝好後,運行命令
[email protected]:~$ mysqlERROR 1045 (28000): Access denied for user 'zhiniaobu'@'localhost' (using password: NO)[email protected]:~$
結果出現錯誤,Google了半天,結果越來越沒耐心,這時候翻了翻自己買的書籍,輸入了以下的命令
[email protected]:~$ mysql -uroot -pmysql
當中
第一個mysql是命令,
-uroot是指定使用者為root,
-pmysql是輸入登入password,第二個mysql是password,假設你設定的password是別的,就換成自己安裝時設定的password,切記
password和-p之間
不要有空格,不然會失敗的。以下是我成功登入後,查看當前全部存在的資料庫。
[email protected]:~$ mysql -uroot -pmysqlWelcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 61Server version: 5.5.37-0ubuntu0.14.04.1 (Ubuntu)Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> show databases;+--------------------+| Database |+--------------------+| information_schema || mysql || performance_schema |+--------------------+3 rows in set (0.00 sec)mysql>
ubuntu14.04安裝MySQL