I am creating a db in mysql for a java program.My program works well in my friends system.But I have some problem with my mysql.
The query is below:
My solution was to run
mysql_upgrade -u root
Scenario: I updated the MySQL version on my Mac with 'homebrew upgrade'. Afterwards, some stuff worked, but other commands raised the error described in the question.
You can run the following query to check for the existance of the user table.
SELECT * FROM information_schema.TABLES
WHERE TABLE_NAME LIKE '%user%'
See if you can find a row with the following values in
mysql user BASE TABLE MyISAM
If you cant find this table look at the following link to rebuild the database How to recover/recreate mysql's default 'mysql' database
Try run mysqladmin reload
, which is located in /usr/loca/mysql/bin/
on mac.
Your database may be corrupt. Try to check if mysql.user exists:
use mysql;
select * from user;
If these are missing you can try recreating the tables by using
mysql_install_db
or you may have to clean (completely remove it) and reinstall MySQL.
Looks like something is messed up with your MySQL installation. The mysql.user
table should definitely exist. Try running the command below on your server to create the tables in the database called mysql
:
mysql_install_db
If that doesn't work, maybe the permissions on your MySQL data directory are messed up. Look at a "known good" installation as a reference for what the permissions should be.
You could also try re-installing MySQL completely.
'Error Code: 1046'.
This error shows that the table does not exist may sometimes be caused by having selected a different database and running a query referring to another table. The results indicates 'No database selected Select the default DB to be used by double-clicking its name in the SCHEMAS list in the sidebar'. Will solve the issue and it worked for me very well.