i am new at AWS lightsail, basically just following the instruction step by step create a instance, create a database named mypost, and upload all file to instance by filezilla, and then use potty to connect phpmyadmin, export local database into online database, but somehow when i test the link on browser it tell me Connection Error: SQLSTATE[HY000] [1049] Unknown database 'mypost' , i checked both phpmyadmin and database in the aws console all named mypost, i also switched to public mode as well, anyone know why is it?
Related
i must connect to sqlite db file using doctrine,
when i copy db file to php(composer) project i can easily connect to DB,
but when i try to make absolute path it says SQLSTATE[HY000] [14] unable to open database file
i'm using symfony4.2 project for it and doctrine2.5
my .env is like this
DATABASE_WSW="sqlite:////C:\\Program Files\\programX\\db.sqlite" or
DATABASE_WSW="sqlite:////C:\Program Files\programX\db.sqlite" or
DATABASE_WSW="sqlite:////C:/Program Files/programX/db.sqlite"
above examples don't work
when used like this works:
DATABASE_WSW=sqlite:///db.sqlite
what I'm doing wrong?
I've created a Laravel 5.3 project on my local apache server(XAMPP) and it works fine with login and registration.
However, when I upload(via FTP) to my server(the server is 000webhosting) and try to do login it returns an error saying:
PDOException in Connector.php line 119:
SQLSTATE[HY000] [2002] Connection refused
I've already changed the .env to match the server DB's info, and just in case I also changed the config/database.php to also match. But it still appears like that?
Do you know exactly everything I have to change in my project so it can work on the server?
May be Your database password changed in live. update .env file
In my project I want to create console commands for dropping and creating DB, just like in Symfony2 like database creation command in laravel console? The way described in the answer to that question works fine for dropping DB, but when I try to create it with this code:
$dbType = \Config::get('database.default');
$dbName = \Config::get('database.connections')[$dbType]['database'];
\DB::statement("CREATE DATABASE `$dbName`");
I get an exception: SQLSTATE[42000] [1049] Unknown database 'my_awesome_db_name'. Any ideas?
Laravel is trying to connect to MySQL and select the database my_awesome_db_name. This isn't possible, because that database name doesn't exist yet (you haven't created it), so MySQL fails on the internal USE my_awesome_db_name command.
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