首页 > 编程知识 正文

linux下查看mysql用户的简单介绍

时间:2024-03-07 18:23:13 阅读:331578 作者:ZREW

本文目录一览:

linux mysql怎么查看用户名和密码

如果在安装过程中没有设置用户名密码的话,可以用root用户名与密码登录数据库:用户名:root 密码为空。 如果设置过密码忘记了,那不好意思,不能查看,只能修改。

linux怎么查看mysql用户名

使用命令:

select

host,user,password

from

mysql.user;

来查看用户。

想要了解更多关于Linux的资讯和文章请关注《linux就该这么学》。

查看linux下mysql中有哪些用户

使用命令: select host,user,password from mysql.user; 来查看用户。

想要了解更多关于Linux的资讯和文章请关注《linux就该这么学》。

请教,linux下mysql如何查询用户的密码

linux忘记mysql密码处理方法,下面提供了5种linux忘记mysql密码找回方法哦。

方法一:

# /etc/init.d/mysql stop

# mysqld_safe --user=mysql --skip-grant-tables --skip-networking

# mysql -u root mysql

mysql update user set password=password('newpassword') where user='root';

mysql flush privileges;

mysql quit

# /etc/init.d/mysql restart

# mysql -uroot -p

enter password: 输入新设的密码newpassword

mysql

方法二:

直接使用/etc/mysql/debian.cnf文件中[client]节提供的用户名和密码:

# mysql -udebian-sys-maint -p

enter password: 输入[client]节的密码

mysql update user set password=password('newpassword') where user='root';

mysql flush privileges;

mysql quit

# mysql -uroot -p

enter password: 输入新设的密码newpassword

mysql

方法三:

这种方法我没有进行过测试,因为我的root用户默认密码已经被我修改过了,那位有空测试一下,把结果告诉我,谢谢!!

# mysql -uroot -p

enter password: 输入/etc/mysql/debian.cnf文件中[client]节提供的密码

方法四:

方法如下: 1, 关闭mysql服务 /etc/init.d/mysqld stop 2,使用 –skip-grant-tables选项启动mysql服务,可以修 改/etc/inin.d/mysqld脚本启动位置增加此选项, vi /etc/init.d/mysqld

方法如下:

1, 关闭mysql服务

/etc/init.d/mysqld stop

2,使用 –skip-grant-tables选项启动mysql服务,可以修 改/etc/inin.d/mysqld脚本启动位置增加此选项,

vi /etc/init.d/mysqld

在下面运行启动的语句里增加--skip-grant-tables

/usr/bin/mysqld_safe --skip-grant-tables --datadir="$datadir" --socket="$socketfile"

--log-error="$errlogfile" --pid-file="$mypidfile"

加入--skip-grant-tables的意思是启动mysql服务的时候跳 过权限表认证。启动后,连接到mysql的root不需要口令

3,重新启动mysql服务

/etc/init.d/mysqld start

4. 修改root用户的密码;

mysql update mysql.user set password=password('123456') where user=root;

mysql flush privileges;

mysql quit

5. 重新启动mysql,就可以使用 新密码登录了。

mysql

mysql -u root –p

输入密码:123456

6,关闭mysql服务

/etc/init.d/mysqld stop

7, 重新修改第2步修改的/etc/init.d/mysqld,使其保持原来不变,也就是取消--skip-grant-tables语句

8,重新 启动mysql服务

/etc/init.d/mysqld start转载请注明文章来源:

linux中如何查看mysql配置?

首先先看看你的mysql在哪,通过which命令

which mysql

显示出目录比如我的是下面这个

/usr/bin/mysql

接下来就可以针对这个目录通过一些命令查看配置文件在哪了,如下

/usr/bin/mysql --verbose --help | grep -A 1 'Default options'

然后在下面会出现一些信息比如我的

Default options are read from the following files in the given order:

/etc/mysql/my.cnf /etc/my.cnf ~/.my.cnf

这个信息的意思是:

服务器首先读取的是/etc/mysql/my.cnf文件,如果前一个文件不存在则继续读/etc/my.cnf文件,如若还不存在便会去读~/.my.cnf文件

linux ubuntu怎么查看mysql用户

mysql -u root -p //以root账户登陆之后

use mysql;

select User from user;

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。