Access denied for user to database "essentialmode"
Importing an SQL file and MySQL answers with Access denied for user to database "essentialmode"? Nothing is broken. The dump is trying to create or switch to a database that is not yours, and you only have to remove a few lines.
Why This Happens
Most ESX and QBCore SQL files circulating online were exported from someone's own machine, where the database was called essentialmode. That export starts with lines like these:
CREATE DATABASE IF NOT EXISTS `essentialmode`;
USE `essentialmode`;
Your MySQL user has rights on its own database only, and that database has a generated name such as s83519_example. The moment the import reaches CREATE DATABASE or USE, MySQL refuses and the whole import stops.
Look Up Your Own Database Name
- In the game panel, open your server and click Databases under MANAGEMENT.
- The Database field on the card is the only database you can import into. No database yet? Create one first.
Remove the Database Lines from the SQL File
- Open the
.sqlfile in a text editor such as Notepad, Notepad++ or VS Code. If the file already sits on your server, the panel's own Files editor works just as well. - Delete every line starting with
CREATE DATABASE,USE,CREATE USERorGRANT. They sit at the very top of the file. - Save the file.
Everything below those lines, the CREATE TABLE and INSERT statements, is what you actually need.
Import Again
- Import the file into your own database with HeidiSQL, or press Open in phpMyAdmin on the Databases page and use the Import tab there.
- Select your own database first, so the statements land in the right place.
Finished
The import runs through now. If it stops on a different message, read Duplicate entry for key PRIMARY. Once the tables are in, point your server at the same database: connect your server to a database.
Czy to rozwiązało twój problem?
Dalej nie działa?
Nasz zespół wsparcia naprawdę zna gry, które hostujemy. Otwórz ticket, rozwiążemy to razem.
Otwórz ticket