Home > Database > Mysql Tutorial > body text

ubuntu14.04安装MySQL

WBOY
Release: 2016-06-07 15:56:37
Original
1393 people have browsed it

今天开始安装MySQL,本来是去官网下载安装包来安装的,可是安装之后却不能用,估计是要配置吧,在网上搜了很多的资料,结果还是失败。所以只好在软件源中安装,这样就省去很多不必要的麻烦了。 zhiniaobu@telunsu-K55VD:~$ sudo apt-get install mysql-server

今天开始安装MySQL,本来是去官网下载安装包来安装的,可是安装之后却不能用,估计是要配置吧,在网上搜了很多的资料,结果还是失败。所以只好在软件源中安装,这样就省去很多不必要的麻烦了。
zhiniaobu@telunsu-K55VD:~$ sudo apt-get install mysql-server
[sudo] password for zhiniaobu:
Copy after login

执行该命令后,系统还会自动安装其它的一些软件,在安装过程中会提示输入mysql的登入密码。\

如果系统版本不一样,提示的方式可能不一样,不过总体来说都差不多。安装好后,执行命令

zhiniaobu@telunsu-K55VD:~$ mysql
ERROR 1045 (28000): Access denied for user 'zhiniaobu'@'localhost' (using password: NO)
zhiniaobu@telunsu-K55VD:~$ 
Copy after login
结果出现错误,谷歌了半天,结果越来越没耐心,这时候翻了翻自己买的书籍,输入了下面的命令
zhiniaobu@telunsu-K55VD:~$ mysql -uroot -pmysql
Copy after login
其中第一个mysql是命令,-uroot是指定用户为root,-pmysql是输入登入密码,第二个mysql是密码,如果你设置的密码是别的,就换成自己安装时设置的密码,切记密码和-p之间不要有空格,不然会失败的。下面是我成功登入后,查看当前所有存在的数据库。
zhiniaobu@telunsu-K55VD:~$ mysql -uroot -pmysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 61
Server 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 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 databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
+--------------------+
3 rows in set (0.00 sec)

mysql> 
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact [email protected]
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!