Jump to content

Cannot link to database


RebeccaD

Recommended Posts

I have recently installed PHP, MySQL [server version: 5.5.35-0ubuntu0.13.10.1 (Ubuntu)], Apache Server and phpMyAdmin on my Ubuntu 13.10 PC. I am used to using these to build and maintain websites and associated databases along with cPanel on web servers, but have decided that it would be useful to be able to build and test php pages/MySQL databases locally.

The installation of the above went smothly and Apache amd phpMyadmin are working correctly. My document root folder is /var/www which I have chmod to 777. I have copied some files that I also have on a website and exported its associated database and imported it locally through phpMyadmin.

The php files render correctly in my browser but I do not seem to be able to link to the database. The connection is controlled by a config file which lists hostname, database name, database user and database password. I am used to setting up databases online through cpanel which gives you all of these parameters.

My question is, when setting up databases locally are the database user and database password the same as the user name and password for phpMyAdmin, which for me would be root and <an undiclosed password> ? I don't know of ways of setting up users and associated passwords as you would do through cPanel. Will these values be the same for all databases created or do/can seperate users be created?

Many thanks.

Link to comment
Share on other sites

I do not seem to be able to link to the database.

 

 

first, how do you know that? what symptom or error are you getting?

 

next, you could use your database root username and password in your script, but that is a bad habit to get into as the root database username/password should only be used to manage databases. your script should use a restricted database user that only has the permissions needed by the script.

 

you would create a database user/password through phpmyadmin, than assign that user privileges to the database in question.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.