The DSN prefix is mysql


#1

Hello
do i get the mysql prefix of the server name?

Thank you in advance


#2

Adem, that term is used in templates. If you use a template to create a database quite often they would ask you to insert a prefix. This is used when the template creates your database for you. You normally type it in yourself.

What makes you ask about a prefix. More info? Your image did not post and we can not read it!


#3

Photo updated
Non-commercial hobby, I’m writing a script
Features,
MySQL databases backup and restore
backup and restore web site directories with zip
and cron

do you have a sql prefix? if you have, what?


#4

The image you showed is on a shared server. What this means is that you are given an ID of sorts that is locked into your account. So, creating a database, the server will use your prefix to use as an id for your database. You do not need to use it really.

In your PHP code, you just use the database name that you created after the prefix. If you need to review further details of your database, you can just use the control panel. Normally, you just enter a name for the database, let’s say MyDatabase. Then, you go into your phpMyAdmin page and you will see the database. In that page, you can create tables as needed. And, also, the fields inside each table. You can create a user-id and password for access to the database from PHP. Then, in your PHP code in your website pages, you can access the database tables using this user and password.

Hope this is what you are asking help about.


#5

Just enter a db name to create a database, then connect in PHP using
prefix_dbname

You usually just hardcode db credentials in apps


#6

No problems with adding databases
Do I only have a prefix with php script? for my script.
If so, what’s his name?

I guess that’s not a good idea
My script doesn’t connect to server like cPanel
That’s a bad idea

I’m sorry, I kept you busy


#7

I don’t really understand. But your image shows a db creation page on cpanel where you can create databases. To separate databases for each user they auto prefix it so all your databases start with xxxxx_

In order to connect to it just use the entire thing as the database name in PHP (or wherever else you’re connecting from)
xxxxx_dbname