RebeccaD Posted January 26, 2014 Share Posted January 26, 2014 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. Quote Link to comment https://forums.phpfreaks.com/topic/285690-cannot-link-to-database/ Share on other sites More sharing options...
mac_gyver Posted January 26, 2014 Share Posted January 26, 2014 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. Quote Link to comment https://forums.phpfreaks.com/topic/285690-cannot-link-to-database/#findComment-1466627 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.