I have installed wordpress and I am trying to connect database. I am seeing this error:
Cannot select database
The database server could be connected to (which means your username and password is okay) but the database could not be selected.
Are you sure it exists?
Does the user root have permission to use the database?
On some systems the name of your database is prefixed with your username, so it would be like username_. Could that be the problem?
If you do not know how to set up a database you should contact your host. If all else fails you may find help at the WordPress Support Forums.
I have checked that Database name, username and database host are correct but still I am not able to solve the error. I have tried using 127.0.0.1 but still no success.
The user needs to be given permissions to access the database.
Related
I am working for the first time on one hosting with TYPO3, and seems that I can't connect to database during initial setup (first install). My username and passwords are correct, and I can access to database using other methods but i simply can't with TYPO3 install tool. I tried with default hosts (e.g. localhost and default 127.0.0.1) and even socket based connection but nothing.
Any help please?
Best regrads
I had a similar problem on my local development machine. The solution for me was to comment out the skip-networking line in the MySQL server configuration file my.cnf
At first localhost or 127.0.0.1 will be successful as long as the mysql server is located on the same server.
Either you can create an special typo user for the server and bind it to an DB or you can use the default root user. Any other user also migth work depending on the configuration. Here you should check the accessrigths for the user u want TYPO to log in as.
For the password section you have to check if the user needs a password. If not just omit it.
Also try to select an empty but existing database
The connection type is not really relevant cause most of the problems are caused by wrong host,user, password, database settings.
I installed the php script and all wen well but the problem is at the final step, when I need to fill the database information, when I field the database information I find that i am getting an error that says "Error connecting to SQL host", so I try and try in different ways but there is no solution, nevertheless, I installed the same script on my localhost and all went well without problems, my Hosting Provider is: Siteground
Filling Database Information Image
Showing the Error Image
You must grant write permissions to the connect.php file for the user who is running the web service for example apache.
Have you ssh access to the server?
If your application cannot connect to the database you should make sure that:
Your application is using the correct MySQL hostname: localhost
Your application is using the correct MySQL database / username /
password.
Don't forget to specify your MySQL username and database with the
prefix yourusername_ in front of its given name. For example, your
cPanel username is siteground and you have named your database
joomla. In this case you have to refer to your database as
siteground_joomla;
Source: https://www.siteground.com/kb/my_script_cannot_connect_to_my_database_/
Another good idea would be to try to use your cPanel username and password for the Database User and Database Password. This will rule out whether you have granted all privileges to your database user.
Also you should change the permissions of your connect.php file to 755, as if you set them to 777, this will cause an internal server error.
Big picture: trying to update a 5 year old WordPress site without losing all the calendar plug-in posts.
Macro: downloaded MAMP to setup a local test site. Cannot get past index page to connect to database.
What works:
Index page shows my test sites (I have three versions of wordpress
Installed (3.0.5 / 3.9.1.1 / 4.4.2), so I can incrementally test and
upgrade)
I can login to phpMyAdmin no problem
I exported the old database to a .sql file, then imported it up to the new Local database, it showed up fine, but tells me "Your PHP MySQL library version 5.1.73 differs from your MySQL server version 5.5.48"
The wp-config.php usernames and passwords all match to the database
After many searches and most of the day trying different things, I am stumped. Obviously, I am a complete noob to MySQL and PHP.
What I have tried:
Changing port to 90 instead of 80
Changing the user to 'root' and 'admin'
Changing from define('DB_HOST', 'localhost’); to define('DB_HOST', '86.42.246.7:80’); and define('DB_HOST', '86.42.246.7:90’);
Notes:
I initially edited the files with textedit, but noticed it was changing single quotes to leave syntax errors - now I'm using Dreamweaver.
Is it possible I could just import each table one at a time into a newly created database?
Please help me out!
EDIT
I changed the database password, but I got this error message
"phpMyAdmin tried to connect to the MySQL server, and the server rejected the connection. You should check the host, username and password in your configuration and make sure that they correspond to the information given by the administrator of the MySQL server."
I have a server hosted on 000webhost.com
In the file manager there is a public_html folder where I store my website files, but no \usr folder.
Generally I could just access this file through the command line or terminal but this is not the case on this server. Unless there are command line tools that I simply couldnt find (I know it is a linux server);
I ran phpinfo() and the configuration file path was in usr/local/lib but I have no idea how to access that.
Any ideas? Thanks in advance.
Go to http://www.000webhost.com/faq.php look at the section on connecting to MySql. Your solution is likely there.
Here is a synopsis:
If you cannot connect to MySQL server, there could be some causes:
- Incorrect MySQL hostname.
Never use 'localhost' as your MySQL hostname! You can find your MySQL hostname by logging on to members area, entering control panel and clicking on MySQL icon.
- Incorrect MySQL username / password or database name.
You can find / setup MySQL username and database by clicking on MySQL icon from control panel. And you can change MySQL password by clicking on phpMyAdmin icon.
- Database failed to setup.
In a very rare cases MySQL database can fail to setup. To confirm this, please try to enter phpMyAdmin for any database. If you see database there, that means it setup was successful. And if you get access denied error by trying to enter phpMyAdmin, please delete the database and setup the same MySQL database again.
Please note that always you must give about 1 minute for any changes to apply on server.
If you still unable to connect to MySQL you check if it is server or your script problem in this way: if you can enter phpMyAdmin and see you database there, that means everything is working fine on our side. It's a problem with your PHP script.
I tried setting up WordPress on a Mac, I got Apache running, PHP is up and going and MySQL is running. I put WordPress in library/webserver/documents and I visit localhost/wordpress/wp-admin to do the install, and get an error establishing database connection.
So I check the database information and password and database name. Everything is correct down to the last syllable in the password, name and database name....
Why am I getting this? I have set up WordPress on Ubuntu and Windows without any issue, but why does a Mac present a problem?
With wp_debug on, it states my password is wrong. I have tried logging into MySQL with the password given and the user name - it works... so that is clearly not wrong...
If you're using MAMP, make sure that the disk location of the virtual host is correctly configured. I.e., pointing to library/webserver/documents.