ubuntu14.04安装MySQL

本文记录了在Ubuntu系统上安装MySQL的过程及遇到的问题解决办法。包括从软件源安装MySQL服务器,解决安装后无法登录的问题,并成功登录MySQL进行数据库管理。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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

运行该命令后,系统还会自己主动安装其他的一些软件,在安装过程中会提示输入mysql的登入password。

假设系统版本号不一样,提示的方式可能不一样,只是整体来说都差点儿相同。安装好后,运行命令

zhiniaobu@telunsu-K55VD:~$ mysql
ERROR 1045 (28000): Access denied for user 'zhiniaobu'@'localhost' (using password: NO)
zhiniaobu@telunsu-K55VD:~$ 
结果出现错误,谷歌了半天,结果越来越没耐心,这时候翻了翻自己买的书籍,输入了以下的命令
zhiniaobu@telunsu-K55VD:~$ mysql -uroot -pmysql
当中第一个mysql是命令,-uroot是指定用户为root,-pmysql是输入登入password,第二个mysql是password,假设你设置的password是别的,就换成自己安装时设置的password,切记password和-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> 

转载于:https://www.cnblogs.com/mengfanrong/p/4197351.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值