Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

MySQL command to remove anonymous access

Posted on 2012-03-30
5
Medium Priority
?
458 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 84

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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
This post looks at MongoDB and MySQL, and covers high-level MongoDB strengths, weaknesses, features, and uses from the perspective of an SQL user.
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…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

610 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