I have set up xampp server where I am developing a laravel app:
Every day (when I make an update to my app) I have to export and import the SQL from the database. That takes a lot of time if I have worked on 10 apps that day :(
Is there a way I can use the online database with a local test version of laravel?
I am using shared hosting and not migrations. I insert tables myself.
Online I see a tab:
access hosts: 'localhost'
I can add a host, but what name should I add and how can I get laravel to access this host?
Could it be 'subdomain.mywebsitename.nl/hostname'?
I'm too scared my app will crash if I change it :s
This i tried this after the solution i got:
I filled in a host. This is the same url i fill in my adress bar.
'host' => 'http://safetyanalyse.nl:2222/',
'host' => 'http://safetyanalyse.nl',
Both options do not work :( Do i have to put the port number somewhere else?
I also have this error:
SQLSTATE[HY000] [1130] Host 'D97A1650.cm-3-3a.dynamic.ziggo.nl' is not allowed to connect to this MySQL server
Step 2 (next i tried this).
In the error it says something about the host, i tried filling in this host.
'host' => 'D97A1650.cm-3-3a.dynamic.ziggo.nl',
Now i get the error:
SQLSTATE[HY000] [1045] Access denied for user 'safety_cert-user'#'d97a1650.cm-3-3a.dynamic.ziggo.nl' (using password: YES)
Try to use domain name as host, that should work.
Also, look for port, if specified.
All this information should be provided to you is hosting control panel. If not, I would change hosting provider.
Edit
Define your host without protocol.
In your app/config/database.phpset
'host' => 'safetyanalyse.nl',
Related
i want just to host a website previously work , into another web server
i have change parameters.yml file with new host parameteres of connection
i have upload all my files , and i have import my databases
when i try to enter (myhost/web ) i have this errors : Access denied for user 'root'#'localhost' (using password: NO)
error.log
[07-Dec-2022 15:30:13 Africa/Algiers] PHP Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[28000] [1045] Access denied for user 'root'#'localhost' (using password: NO)' in /home2/icares/logicom.dz/ncomparer/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:43
Stack trace:
#0 /home2/icares/logicom.dz/ncomparer/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php(43): PDO->__construct('mysql:host=127....', 'root', NULL, Array)
#1 /home2/icares/logicom.dz/ncomparer/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOMySql/Driver.php(45): Doctrine\DBAL\Driver\PDOConnection->__construct('mysql:host=127....', 'root', NULL, Array)
#2 /home2/icares/logicom.dz/ncomparer/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(360): Doctrine\DBAL\Driver\PDOMySql\Driver->connect(Array, 'root', NULL, Array)
#3 /home2/icares/logicom.dz/ncomparer/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(429): Doctrine\DBAL\Connection->connect()
#4 /home2/icares/logicom.dz/ncomparer/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(389): in /home2/icares/logicom.dz/ncomparer/app/cache/prod/classes.php on line 3390
I have change the parameters of connection with new server , but the error is that username root password no and server is localhost , what i must do ?
The error.log says that your Symfony trying to access database (probably MySQL) via the user 'root' from a local host. But your database, MySQL is not set to allow access as 'root'.
MySQL and most databases do not allow to access as 'root' as default as security reason, especially without password (what your erro said).
So, may be you need to check:
What is your database_user and database_password set in Symfony project (parameters.yml?)
Check MySQL from cli that what kind of previleges are set for your database.
The way to access mysql without password may find here:
Allow linux root user mysql root access without password
Or some hints may be here:
How to create a root user with no password in mysql
I have created a Cake solution locally and have uploaded this on my hosting provider's environment. It runs MySQL. I have full access to the respective database but of course not the MySQL main database. If I understand the situation correctly, there are multiple databases in the same environment used by other clients on different domains that I would never see.
The provider has disabled the ability to manage user rights in PHPMyAdmin. Through an admin panel I was able to create a user that is granted INSERT, UPDATE, SELECT and DELETE rights. However, with the specified datasource parameters in appl_local.php, I get the message below when I try to add a new user to the database through the users/add page. For security reasons I have marked the name of the user with asterisks in the code below.
Could it be that I have to more specifically explain on which database we are trying to execute this?
Is there a way to tell the system to always specify the database when asking for a table? For example "SELECT * FROM database_name.users" instead of just "SELECT * FROM users"? I ask this because in the message below it does not specify which database was accessed when this error was raised, only the command, the user, the table and the source code file and line number.
Or is there some schema that needs to be specified when working in a shared environment?
2021-01-07 10:39:00 Error: [PDOException] SQLSTATE[42000]: Syntax error or access violation: 1142 SELECT command denied to user '******'#'localhost' for table 'users' in /home/multigra/domains/multi-grade.nl/public_html/content/vendor/cakephp/cakephp/src/Database/Statement/MysqlStatement.php on line 39
'default' => [
'host' => 'localhost',
/*
* CakePHP will use the default DB port based on the driver selected
* MySQL on MAMP uses port 8889, MAMP users will want to uncomment
* the following line and set the port accordingly
*/
'port' => '3306',
'username' => '******',
'password' => '******',
'database' => '******',
/**
* If not using the default 'public' schema with the PostgreSQL driver
* set it here.
*/
//'schema' => 'myapp',
/**
* You can use a DSN string to set the entire configuration
*/
'url' => env('DATABASE_URL', null),
],
This was an overight from my end. I had specified the location of information a little too much in order to learn about specifying databases when data is spread over different databases. Because the production environment connects to a different database, the requested table was not found at all. The error "SELECT command denied to user '******'#'localhost' for table 'users'" did not point me in that direction. I thought it was a permission issue. Instead, the table was not found in the database and that's why the SELECT statement failed.
I'm trying to load the RDS in the phpMyAdmin. Therefore I edited the following parameters in the /etc/phpmyadmin/config.inc.php
$cfg['Servers'][$i]['host'] = 'RDS-ENDPOINT-URL';
$cfg['Servers'][$i]['port'] = '3306';
$cfg['Servers'][$i]['user'] = 'USER';
$cfg['Servers'][$i]['password'] = 'PASSWORD';
But my new RDS instance is not showing up in the phpMyadmin, any idea why?
From analysis I identifies that even though renaming the /etc/phpmyadmin/config.inc.php file to something else, phpMyadmin is working without any issues. Additionally when I tried the RDS instance Endpoint in the browser URL it says This site can’t be reached. Is these all normal?
EDIT
Security Group set as
Inbound: Type -> MYSQL/Aurora Source -> 0.0.0.0/0
Outbound: Type -> All traffic source -> 0.0.0.0/0
FYI: I updated my Windows localhost xampp phpmyadmin/config.inc.php file and the RDS working fine.
However still with EC2 DNS URL RDS instance is not showing up.
i.e {EC2}.ap-southeast-1.compute.amazonaws.com/phpMyAdmin
Spec:
Ubuntu 14.04
webmin/virtualmin 1.791
I am using following code to test remote mysql database connection:
<?php
$db_host = "123.456.789";
$db_name = "database";
$db_user = "user";
$db_pass = "password";
$db_table_prefix = "prefix_";
GLOBAL $errors;
GLOBAL $successes;
$errors = array();
$successes = array();
$mysqli = new mysqli($db_host, $db_user, $db_pass, $db_name);
GLOBAL $mysqli;
if(mysqli_connect_errno()) {
echo "Conn Error = " . mysqli_connect_error();
exit();
}
?>
I keep getting this error:
No connection could be made because the target machine actively
refused it.
Research shows this means the server is "not listening". Before I ran the above script I've already tried to allow remote mysql access through webmin gui. What I did is editting "database manage->host permissions" and make it as follows:
This was supposed to allow remote mysql access but it doesn't work. Also I read from somewhere else that to allow remote mysql access I need to edit /etc/mysql/my.cnf; I have thought that after I edit the "host permissions" in webmin this file would be changed, but it was not. On the other hand, I couldn't find the lines I was supposed to edit in my.cnf, so I am stuck here.
Any help is appreciated.
You can do this via webmin too,
Create your user account for remote access
Webmin > Servers > MySQL Database Server > User permissions
Allow the MySQL server to listen to remote requests
Webmin > Servers > MySQL Database Server > MySQL Server Configuration
MySQL server listening address - set it to any
Restart MySQL using service mysql restart or directly from webmin.
Allowing MySQL to listen to any port is not a good idea , unless you are the only one who can access that network ,
Don't leave it like this afterwards , Its better to Allow certain hosts on certain domains , like your IP , Or simply just dont listen on all ports if its not required i.e when you are finished with your session.
You can also do this via /etc/mysql/my.cnf
Just add a binding adress of your choice instead of localhost
I have got it to work, however not through webmin at all.
First I need to comment out the following line in /etc/mysql/my.cnf:
#bind-address = 127.0.0.1
I guess instead of simply commenting it out, I can also change 127.0.0.1 to my local IP address. Many google results stop here, but this is not enough. The next step is to grant the local user privileges: On remote server, I need to run the following commands:
$ mysql -u root -p
Enter password:
mysql> use mysql
mysql> GRANT ALL ON . to user#'localIP' IDENTIFIED BY
'password';
mysql> FLUSH PRIVILEGES;
Actually I have seen this when I was doing google search before I asked the question here, but I just ignored it because I thought I've done it. It turns out I not only need to grant privileges on server side but also need to do it for "local user".
Feel free to comment here if there's still something I missed out or you know how to do it throught webmin(I am still wondering what editting "host permissions" in webmin does).
I'm using Phil Sturgeons Rest as an API between the server and mobile APP. Locally this works brilliantly, on the server it bounces back with an issue when using API Keys authentication:
Unable to connect to your database server using the provided settings.
Filename: core/Loader.php
This is while $config['rest_enable_keys'] = TRUE; is enabled, when I change the variable to false the API service works just fine. Both locally and the server are running the same table layout and both have the same API key in the keys table. Rest of the site works fine doesn't show any database connection errors.
Changing the line $config['rest_database_group'] = 'default'; prompts a different error, which would lead me to believe that it is infact connecting to the correct database, just can't establish the keys table?
You have specified an invalid database connection group.
There's no difference in the code between the server and locally yet locally I get the correct error message of {"status":false,"error":"Invalid API Key."}
Could this be an issue with using multiple database connections? I checked the environment and it seems to be correct but this wouldn't explain why it would work locally.
Thanks a lot to nithin-meppurathu who helped me debug the core of the rest library to find the problem.
The problem lied in the multiple database connections, due to switching what is used depending on the environment it was always being defaulting back to the 'default' database environment. Changing $config['rest_database_group'] = 'default'; to my ENVIRONMENT variable I was able to get it pointing to the correct place.