Reputation:
I have a php script that I am try to install on my server, however I do not know what these values would be in the script. . .
$hostname = 'localhost'; // Your Host Name
$database = 'mydatabase'; // DataBase Name
Would the host name be the domain? and what would the database be? Any help would be much appreciated.
-Chris
Upvotes: 0
Views: 291
Reputation:
localhost for the hostname is correct in most cases.
The name of the database is whatever you called it. You need to create an empty database before you can use it somehow from PHP. If you have shell access to the server, and asuming you are using MySQL, this can be done with mysqladmin, e.g.
$ mysqladmin -u root -p create DatabaseName
and then grant access to the user which accesses it by PHP, e.g.
$ mysql -u root -p
mysql> GRANT ALL ON DatabaseName.* TO username@localhost IDENTIFIED BY 'notmypassword';
mysql> FLUSH PRIVILEGES;
If you have bought webspace somewhere, it's likely that there's some kind of user panel where you can create databases.
Upvotes: 2