Home > Database > Mysql Tutorial > Ubuntu下MySQL数据库的安装使用

Ubuntu下MySQL数据库的安装使用

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-07 16:51:11
Original
785 people have browsed it

首先:sudo apt-get install mysql-server mysql-client安装完成后,mysql服务即开始运行了.此时需要修改root密码,但经常会出现这么

首先:sudo apt-get install mysql-server mysql-client
安装完成后,mysql服务即开始运行了.此时需要修改root密码,但经常会出现这么一种情况
'Access denied for user 'root'@'localhost' (using password: YES)' 或者其他致使无法登录mysql的情况。这里可以按如下步骤解决:

1.打开/etc/mysql/debian.cnf文件,里面存储了相关的密码.
sudo gedit /etc/mysql/debian.cnf
在[client]段有user=以及password=这两行,此即我们需要的东西

2. 输入命令:mysql -udebian-sys-maint -p
debian-sys-maint即debian.cnf中user=后面的内容.回车后会提示输入密码,此时把password=后面的内容复制粘贴后回车即可进行mysql控制台(一般不要照打,容易出错,,复制即可)

3.进入控制台后.按以下步骤进行:
use mysql;
update user set password=PASSWORD('新密码') where user='root';
FLUSH PRIVILEGES;
此时可以输入quit;退出后用root帐号登录,也可以继续其他操作

卸载mysql:sudo apt-get remove mysql-server mysql-client
sudo apt-get autoremove

linux

Related labels:
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 admin@php.cn
Latest Issues
MySQL stops process
From 1970-01-01 08:00:00
0
0
0
Error when installing mysql on linux
From 1970-01-01 08:00:00
0
0
0
phpstudy cannot start mysql?
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template