?
Solved

MySQL command to remove anonymous access

Posted on 2012-03-30
5
Medium Priority
?
455 Views
Last Modified: 2012-03-30
Hi

What is the correct MySQL command line syntax to remove anonymous access?

I tried this but it returns an error:

mysql> DELETE FROM mysql.user WHERE user = ;

When I enter this information it gives me error:

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
0
Comment
Question by:Jason210
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 7

Assisted Solution

by:torakeshb
torakeshb earned 400 total points
ID: 37786057
0
 
LVL 7

Expert Comment

by:torakeshb
ID: 37786059
mysql> DROP USER ''@'localhost'; and mysql> DROP USER ''@'host_name' if its linux server
0
 
LVL 5

Expert Comment

by:Ronak Patel
ID: 37786061
you need to pass value of "user" which you want to remove from table. and also there wo'nt be a semi-colon at the end of the statement.

try this... (replace "username" with the name of the user you want to delete)
DELETE FROM mysql.user WHERE user = 'username' 

Open in new window

0
 
LVL 83

Accepted Solution

by:
Dave Baldwin earned 1600 total points
ID: 37786072
You might want to first find out if there is one.

SELECT User,Password FROM mysql.user;

Then if you see a blank line or password, you can delete it.

DELETE FROM mysql.user WHERE User = '';

or..

DELETE FROM mysql.user WHERE Password = '';

Remember the table and column names are case-sensitive on Linux.
0
 
LVL 11

Author Closing Comment

by:Jason210
ID: 37786263
Ok, it looks like I missed the two apostrophies. <br /><br />Thanks also for the tip on how to check to see if there is such a user.
0

Featured Post

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows the steps required to install WordPress on Azure. Web Apps, Mobile Apps, API Apps, or Functions, in Azure all these run in an App Service plan. WordPress is no exception and requires an App Service Plan and Database to install
Containers like Docker and Rocket are getting more popular every day. In my conversations with customers, they consistently ask what containers are and how they can use them in their environment. If you’re as curious as most people, read on. . .
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question