Forums

Failing to Grant privileges in MySQL

I am trying to grant user privileges to myself. I am getting an error 'Access denied' So I have tried to Grant privileges to myseld and am getting the following feedback

mysql> SHOW GRANTS FOR myname@mtname.mysql.pythonanywhere-services.com;

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 '-services.com' at line 1

I am using Windows 10, the command does not line the '-' in the host name

Can you advise what I should use in place of the -

I have tried through the Database tab and used the Bash Console

thanks in advance

You should quote things correctly:

SHOW GRANTS FOR 'myname'@'mtname.mysql.pythonanywhere-services.com';

or you could not include the server name:

SHOW GRANTS FOR 'myname';

have you tried to grant insert privileges? is it possible? haven't been able to get it to work.

Unless you've done something very strange, you shouldn't need to grant yourself privileges in our mysql consoles? We do that for you...

Hi, I have been faced with the same problem. I will list my actions to make my issue clear to you:

  1. I have mistakenly created database on Databases tab with name "myname"$default
  2. I have created database with the name "myname"$desired_db_name
  3. I have removed by

    drop database myname"$default;

command

And now, I'm not able to grant all privileges to myself

You don't have admin privileges in MySQL.

Is there something in particular you are trying to do that you can't do?

Hi, I have messed with my mysql server. I had removed my default database "Akop4$default" using

drop database Akop4$default;

please reinstall my mysql server. I wasn't aware that it is system database. I thought i have created it by mistake

if you go to your pythonanywhere databases tab, you can create a database called default yourself.

if you go to your pythonanywhere databases tab, you can create a database called default yourself.

as I understand default database is a system database where all users info is stored. If I create default database by my self i would be empty. Can you reinitialize my MyQL?

no- it's not. the "default" database that you create is actually "Akop4$default"

I have tried to create default database, as you mentioned above, but show tables;. tells me: Empty set

can you reinitialize msql? There is a command : msqld --initialize, but due to unclear reasons shell shows me an error: command not found

that's because the Akop$default database has no tables within it. Note that databases (eg: Akop$default, Akop$newdatabase etc) can have multiple tables within it.

Ok, can you just reinstall MySql server?

Hi there,

  1. you cannot grant privileges to yourself. No-one can, as a user. We do that for you.
  2. you cannot delete the system database. We control that. The database named "Akop$default" is just a normal database.

At the moment you should have full permission to create new tables, insert and delete rows into them, inside "Akop$default" and any other databases you create on the Databases tab.

Is there something specific that you're trying to do right now?

o, thank you for good explanation :-) I thought this default databse was created for some technical reasons. If I can contiune without it, tha'ts good.

yep! carry on :)

I want to enable general_log in order to access query records through Mysql workbench. When I execute this: SET GLOBAL general_log = 'ON';

I get an error: ERROR 1227 (42000): Access denied; you need (at least one of) the SUPER or SYSTEM_VARIABLES_ADMIN privilege(s) for this operation

You try to use settings that require system variable privileges which PythonAnywhere users don't have. See https://help.pythonanywhere.com/pages/UsingMySQL/#caveat-you-dont-have-system-administration-privileges-on-pythonanywhere