January 1

How To Create An Anonymous or Limited Access Only Account With MySQL


In MySQL, you have a root user, and you’re able to create other users and grant them varying levels of permissions or privileges to access/create/modify MySQL databases. One thing that you might not know is the ability to create an anonymous user, which means that you (and your applications) can connect to your database without specifying a username and password.

For the creation of this anonymous user account, you can’t use PHPMyAdmin (a popular GUI-based MySQL management tool). What you need to do is to access MySQL via the command line (command prompt in Windows, terminal in Mac), and type the following commands:

mysql -u root -p

After which, you’ll be logged into MySQL. If you get an error that the command is not found, then you’ll need to modify your classpaths so that you can run the MySQL program directly. Alternatively, you can go to the directory in which your MySQL binary files or the application files are, and run that command from there.

Now run these following commands. Note that database-name is your database name, and table-name is your table name.

mysql> use database-name;
mysql> GRANT SELECT ON table-name TO ”@localhost

That will grant “select” privileges to the anonymous user. If you want to grant all privileges, or if you want the privileges to apply to all tables, then you can use a variant of the following command. What it does is to grant all privileges to all tables in your database.

mysql> GRANT ALL PRIVILEGES ON *.* TO ”@localhost

Other posts about scaling up businesses

How To Choose Digital Marketing Channels (A Powerful 6 Step Process)

Leave a Reply

Your email address will not be published. Required fields are marked

{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}
free playbook

Get Your Free 5E Playbook

My 5E playbook is now available for a limited time!