MySQL

Some scripts require a database to run (the product page will say that and the documentation for the script will say it, as well).

Import MySQL table

Bellow is the sql data required for Character Manager

CREATE  TABLE `bd_character` (
    `id`  int(11) NOT NULL AUTO_INCREMENT,
    `steam`  varchar(255) DEFAULT  NULL,
    `discord`  varchar(255) DEFAULT  NULL,
    `name`  varchar(255) DEFAULT  NULL,
    `data` longtext,
PRIMARY KEY (`id`),
UNIQUE  KEY  `id_UNIQUE` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=38  DEFAULT CHARSET=latin1;

To import this data you can use your preferred connection of choice. Many people use phpMyAdmin, so I will show you what you need to do bellow. If you are running MySQL on your local machine make sure that you have both MySQL and Apache running:

screenshot_2023-07-01_160607.png

After that, you can connect to phpMyAdmin by going to http://localhost/phpmyadmin/ Then you will click the database you want to edit:

screenshot_2023-07-01_161126.png

Then on the top bar you will click "Query":

screenshot_2023-07-01_161240.png

Then in the text box you will copy and paste the sql data included in your resource in the sql.sql file and click "Submit query":

screenshot_2023-07-01_161410.png

Then if you get a message that looks like this then you are all done!:

screenshot_2023-07-01_161603.png

If you get an error that looks like this then the table already exists:

screenshot_2023-07-01_161911.png

MySQL connection strings

The MySQL connection string is found in your server.cfg file in the root directory of your server and start with set mysql_connection_string.

Many host providers will give you a database to work with and it will include a connection string using the mysql:// method.

YOUR MYSQL CONNECTION STRING CANNOT START WITH mysql://

IF IT DOES, THEN OUR SCRIPTS WILL THROW AN ERROR!

{:is-danger}

Below is how you can tranlate a string that starts with mysql:// to a format that our scripts can read. (This also works for other Database scripts like oxmysql, mysql-async, etc.)

mysql://user12345678:genericpassword@yourhostprovider.com:3306/s123456_fivem
mysql://user12345678:genericpassword@yourhostprovider.com:3306/s123456_fivem
USERNAME
USERNAME
PASSWORD
PASSWORD
HOST
HOST
PORT
PORT
DATABASE NAME
DATABASE NAME
"user=user12345678;password=genericpassword;server=yourhostprovider.com;port=3306;database=s123456_fivem"
"user=user12345678;password=genericpassword;server=yourhostprovider.com;port=3306;database=s123456_fivem"
Text is not SVG - cannot display

FINAL PRODUCT:

set mysql_connection_string "user=user12345678;password=genericpassword;server=yourhostprovider.com;port=3306;database=s123456_fivem"

If you have trouble converting your connection string try this handy tool made by a member of our community.

If you have set up a Database using the method listed in this wiki on a VPS this will likely be your connection string:

set mysql_connection_string "user=root;server=localhost;port=3306;database=fivemdefault"

NOTE

THE ABOVE DOES NOT INCLUDE A PASSWORD AS THERE IS NOT A PASSWORD SET BY DEFAULT. IF IT DOES INCLUDE A PASSWORD PLEASE ADD password=YOURPASSWORD; INSIDE THE QUOTATION MARKS "

{:is-warning}

For full references on how to set up this type of connection string consult THIS WIKI. Ensure you have all the data in the connection string such as username, password, host IP, and database name. These can be easily converted from URL to string. Also check with your host provider and see if they include database connection information to make setting up the string easier.