Solved

MySQL command to remove anonymous access

Posted on 2012-03-30
5
442 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
5 Comments
 
LVL 6

Assisted Solution

by:torakeshb
torakeshb earned 100 total points
Comment Utility
0
 
LVL 6

Expert Comment

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

Expert Comment

by:Ronak Patel
Comment Utility
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 82

Accepted Solution

by:
Dave Baldwin earned 400 total points
Comment Utility
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
Comment Utility
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

Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

Join & Write a Comment

I use MySQL for many of my development projects in a Windows environment. To manage my databases (and perform queries) for years I used a tool called MySQL administrator.  This tool has since been replaced by MySQL Workbench. So I decided to m…
Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video discusses moving either the default database or any database to a new volume.

728 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now