I am Running wordpress on Ubuntu 18.04 with apache2 and PHP 7.2.24. I deleted the wordpress files and dropped the database to copy another wordpress site. I copied the other wordpress (Files and database) into a new database (new name, new user, new password), Then changed the wp-config.php file values to the (new name, new user, new password). Now when I try to open the site it still trying to connect to old databases as if I didn't change the wp-config.php file, I get this error
Can’t select database
We were able to connect to the database server (which means your username and password is okay) but >not able to select the v3GMwXpnRQjq database.
Are you sure it exists?
Does the user zJ6epncZUYcQ have permission to use the v3GMwXpnRQjq database?
On some systems the name of your database is prefixed with your username, so it would be like >username_v3GMwXpnRQjq. Could that be the problem?
Related
How would I go about doing this (the title is the question), I've changed all my ENV files to my hosted mysql details. When i run php artisan migrate from composer I get the
"denied username#localhost using password yes error".
I've changed the port and everything but I'm not sure what to do anymore and I'm 99% sure that the details are correct I've tried them multiple times
You need check somethings:
are credentials valid (username, password and host)?
the database host is accessible by your application server?
.env file is correctly configured or have some config hard coded in app/config/database.php?
To validade connection, you can try this: http://www.w3schools.com/php/php_mysql_connect.asp
About configuration and enviroments : https://laravel.com/docs/5.2/configuration
I just used artisan migrate to create some table, but I get an error of Type PDO:
[PDOException]
SQLSTATE[HY000] [1045] Access denied for user 'root'#'localhost' (using password: NO)
A php/mysql testscript could connect to the database just fine, but it was another virtualhost and it did not use PDO.
In Laravel4 edited app/config/local/database.php to set the password and database name.
edit in start.php
UPDATE
I hardcoded the password in the PDO connection array and now terminal says there is no database named "database". Clearly it is looking somewhere else for the config, but I have no other config file.
(Due to following a tutorial about making a "local" directory it was not working for me)As it stands, I have downloaded the stable version and everything is working great.
I am going to delete this post, to keep the forum clean.
Make sure you have set up your database connection correctly in app/config/database
Laravel Database Docs
Make sure you are setting up a 'local' environment in start.php
Otherwise Laravel will look for DB config in app/config/database.php
Kindly Check Your app/config/database.php file in local host.
1.)Make Sure local Host Data Base name is Correct
2.)Make sure local Host Data Base username is correct.
3.)Make sure local Host Data Base password is correct.
When I launch the website through local host, I get the following error:
Database Error: Unknown database 'db_name'
I'm having a dig around as to what the problem is. The website belongs to a friend of mine and he wants me to connect the website to the database. The database resides within the root directory. I'm merely trying to connect to it.
In most of the PHP files, there is a tag that includes the config file which contains the details of the database.
Any ideas as to how I can get it working and resolve the Database Error: Unknown database 'db_name' error?
Any help is highly appreciated.
Database should not reside in root directory, it should be imported to database (Mysql) server.
Check in Mysql databases, does your database resides there?
If not, you can do so by phpMyAdmin or navigating to your mysql and importing it.
Create database in mysql and import the sql file as below by opening command-line terminal:
/path/to/mysql/bin > mysql -u username -p < /path/to/root/db.sql
I'm working on a WordPress theme that requires a db in mysql to store lots of data.
I'm currently working on an installation script to install the theme. I have written a function to create a new db in the same mysql that WordPress uses it self.
Every time i run the script, i get redirected to a page stating that WordPress is already installed. But I'm not trying to reinstall WordPress, just create a new db in the same sql that WordPress uses.
I have also written a function to create new tables, which works fine so I'm sure there is no issues with connection.
If this helps, here is the function:
function create_db_mysql(){
require ('con_db_var/db_4216841335655434.php');
$connect = mysql_connect($db_host,$db_user,$db_pswrd) or die(mysql_error());
mysql_query("CREATE DATABASE theme_db",$connect);
mysql_close($connect);
}
I fetch the db info from wp-config.php.
so in the db_4216841335655434.php:
require ('../../../wp-config.php');
$db_host = ( DB_HOST );
//etc etc....
when i call the create_db_mysql(), I get taken to a page telling me that WordPress is already installed and then followed by instructions on how to re-install.
any ideas?
thanks!
Database creation and table creation are different levels of privileges. Many shared hosting providers will not give PHP the access to create a database.
So you might need to use your hosting providers control panels to create the database.
I've downloaded the wamp server and it's online. I'm trying to install Joomla.
At page 4 I'm told Unable to connect to the database
An error has occurred:The database details provided are incorrect and/or empty.
Can anyone help me in fixing this error?
This problem has been fixed by Ocaso Protal, finaly this page ocurs
what should I put here ?Site Name? nd finaly why should i use joomla any specific properties of this product ?
Even if you use the default settings for mysql (user: root, password empty) you should put the username root in the Username field in the form that's showed in your first screenshot.
You must check these things before
Setup a blank database from the Cpanel/Mysql Admin
Fix the username/password and user permissions on this database
Run Joomla... and give it the above credentials + localhost
Make sure you have 777 or adequate permissions otherwise some errors may occur#
If im not mistaken the default account for wamp/xamp myqsl is
user: "root"
password: ""
//Password is null - do not write nothing inside