【MYSQL】解决Mysql直接登录问题(删除匿名用户)(转)

刚安装的Mysql会存在匿名用户。

在命令行下输入mysql,(如果这时提示不是外部或内部指令,那就把mysql server文件下的bin目录添加到系统路径Path中)

如果没有任何提示,直接进入"mysql>"的环境,说明存在匿名用户,需要删除,以免留下隐患。

删除方式为:

1、使用root权限登录

2、mysql> select user,host from mysql.user;

3、mysql> delete from mysql.user where user=‘‘;

然后别忘了重启mysql,重启方式参考上帖重启Apache

时间: 2024-08-25 11:37:35

【MYSQL】解决Mysql直接登录问题(删除匿名用户)(转)的相关文章

【MySQL】MySQL删除匿名用户,保证登录安全

许多MySQL程序都会带有匿名登录的功能.在刚刚安装完MySQL之后,就可以登录数据库啦. 这对于平时使用MySQL来说也基本没有什么,但是如果我们想部署数据库的时候,这种登录方式式绝对不能存在的!试想一下,如果你的数据库随便就可以进入的话,我想你一定会在半夜收到电话,说数据出问题啦! 下面介绍一下删除匿名用户的方式: 首先使用命令进入数据库 [[email protected] raul]# mysql -u root -p Enter password: Welcome to the MyS

MYSQL删除匿名用户的方法(提高安全性)

mysql中删除匿名用户详细步骤如下:[[email protected] ~]#mysql -u root -p ← 通过密码用root登录 Enter password: ← 在这里输入密码 Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 7 to server version: 4.1.20 Type 'help;' or '\h' for help. Type '\c

mysql删除匿名用户

首先使用命令进入数据库 [[email protected] raul]# mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 3 Server version: 5.1.73 Source distribution Copyright (c) 2000, 2013, Oracle and/or its affil

安装完mysql数据库后的优化(删除多余用户和数据库)

1.查看数据库的版本信息: MariaDB [(none)]> select version(); +----------------+ | version()      | +----------------+ | 5.5.52-MariaDB | +----------------+ 1 row in set (0.18 sec) 2.删除多余的账号(除root和localhost的) MariaDB [(none)]> use mysql MariaDB [mysql]> sele

解决mysql报错:- Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'information_schema.PROFILING.SEQ'

mysql执行报错: - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'information_schema.PROFILING.SEQ' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_fu

mysql之mysql安装、初始化,以及mysql相关命令的使用

安装mysql:    1.yum        #wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm 从mysql官网上下载mysql的repo        #yum -y install mysql-server 2.二进制源码包        #tar -xf mysql-xxx.tar.bz2        #cd mysql-xxx        #make && make install

mysql初学,mysql修改,mysql查找,mysql删除,mysql基本命令

Mysql 下载地址https://dev.mysql.com/downloads/mysql/ 1.连接Mysql格式: mysql -h主机地址 -u用户名 -p用户密码 1.连接到本机上的MYSQL.首先打开DOS窗口,然后进入目录mysql\bin,再键入命令mysql -u root -p,回车后提示你输密码.注意用户名前可以有空格也可以没有空格,但是密码前必须没有空格,否则让你重新输入密码. 如果刚安装好MYSQL,超级用户root是没有密码的,故直接回车即可进入到MYSQL中了,M

使用SKIP-GRANT-TABLES 解决 MYSQL ROOT密码丢失(转)

B.5.3.2 How to Reset the Root Password If you have never assigned a root password for MySQL, the server does not require a password at all for connecting as root. However, this is insecure. For instructions on assigning passwords, see Section 2.18.4,

解决MySQL忘记root密码

网上有很多关于忘记MySQL root密码的一些文章,里面都有写怎么去解决,但有时觉得写得太恶心,要么一字不漏的抄别人的,要么就说得不清不楚,好了,不吐槽了,以下是解决的整个过程. 首先我们要知道忘记MySQL root密码后,能否重启mysql,能重启的操作是怎么样的?不能重启的操作又会是怎么样的? 情况一:(能重启情况下) 修改my.cnf配置文件,在mysqld栏下添加skip-grant-tables选项,意思是mysqld server启动之后并不使用权限系统(privilege sy