Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Table 'mysql.user' doesn't exist:ERROR

Tags:

mysql

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:

mysql> create database sampledb;  Query OK, 1 row affected (0.00 sec)  mysql> use sampledb;  Database changed  mysql> create user zebronics identified by 'zebra123';  ERROR 1146 (42S02): Table 'mysql.user' doesn't exist 

I cant create any user for my db.Please help??

like image 432
Abilash Ravichandran Avatar asked Jul 22 '13 05:07

Abilash Ravichandran


2 Answers

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.

like image 166
Markus Avatar answered Sep 22 '22 04:09

Markus


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.

like image 26
jnrbsn Avatar answered Sep 21 '22 04:09

jnrbsn