oxmysql cannot connect to the database
The database is not running, the connection string is wrong, or it is set after oxmysql starts.
The error
[oxmysql] Unable to establish a connection to the database (ECONNREFUSED / ER_ACCESS_DENIED_ERROR)What the code means
ECONNREFUSED: MySQL or MariaDB is not running, or uses a different port.ER_ACCESS_DENIED_ERROR: wrong user name or password.ER_BAD_DB_ERROR: the database name does not exist.Unknown columnorTable doesn't exist: a resource's SQL file was never imported.
How to fix it
- Put the connection string above
ensure oxmysqlinserver.cfg:
Config
set mysql_connection_string "mysql://fivem:[email protected]:3306/fivem?charset=utf8mb4"
ensure oxmysql
- Make sure the database service is running and the database exists.
- If the password has special characters such as
@,#or/, URL encode them (@becomes%40). - Import the
.sqlfile that comes with each resource before starting it.