I am trying to install drupal on remote mysql server. I have created the user in mysql and granted the the privileges.
I am able to connect through command line from my web server like this "mysql -u xxxx -h 10.xxx.yy.zz3 -p".
But when I tried to install drupal I get "SQLSTATE[28000] [1045] Access denied for user 'xxxx'#'localhost'". I have given the privileges for "xxxx"#"10.xxx.yy.zz3" but drupal appends localhost instead of IP to user name. I have changed settings.php to mysql server IP.
What am I missing?
Instead of editing the settings.php file, try the following:
The third screen during installation (Database configuration) let you set up the database on a remote MySQL server. To do so, expand Advanced options and enter the database host.
I cannot guarantee that this will work, but this is how I set up Drupal to use a remote MySQL server, and I have never had this problem. Btw, I always use the canonical domain name (e.g. mysql.example.org) and not the IP-address.
Related
I've currently set up a staging area for my app in Digital Ocean with LAMP stack. The Framework for my app is Laravel 5.5 and Vue 2x.
In development, I've been using remote MySQL and had no issues with the connection error. However, when I moved it to the staging env, it is giving me access denied error. When I looked at it closely to the error log, Access denied is for username#[digital-ocean-droplet-ip], whereas I have properly configured the MySQL credentials to the remote host IP under laravel's config/database file.
So, I am doubtful if I have to do any configuration under Apache to allow any external MySQL connection? I forgot the cmd but I did allow sfw firewall allow to any port 3306 to the remote server IP address in Apache.
Any help is appreciated.
Thanks!
MySQL by default does not create an user with access from remote connections.
First you need to create an user on database that allows connection from outside (%) or a specific IP
CREATE USER 'newuser'#'%' IDENTIFIED BY 'password';
Than give him privileges
GRANT ALL PRIVILEGES ON *.* TO 'newuser'#'%';
The *s could be replaced by your database and table name respectively
You might also check if in your mysql configuration(/etc/mysql/mysql.conf.d/mysqld.cnf in my case) has this line uncommented
bind-address = 127.0.0.1
Change the ip if necessary
restart mysql and apache
sudo service apache2 restart
sudo service mysql restart
Than update the user and password at your .env file and try again!
Current situation is as follows:
I have succesfully installed OpenProject on Ubuntu 14.04 server using the guide from the official website (https://www.openproject.org/open-source/download/packaged-installation-guide/). When configuring for the first time I let the configuration manager install MySQL and create the appropriate database(s).
Now I'm trying to migrate and for this to happen, I need outside access to the information_schema (schema) and database. This is supposedly done using the openproject user but I cannot seem to be able to login using this user on the commandline.
Just to be sure, I just statement below:
mysql -u openproject -D openproject -p
Then I entered the right password and press enter. It gets the default ERROR 1045.
I am however able to login using root user and debian-sys-maint user which was created on the initial install step. The password I used for these accounts were found in the file under "/etc/openproject/installer.dat". I am absolutely positive I use the correct password, for the application runs fine under said user.
Is there a setting in mysql that I am missing that would block users from making connection using the commandline utility?
Figured it out. In MySQL the host 127.0.0.1 and localhost are essentially different. User OpenProject by default gets assigned to host 127.0.0.1, so naturally connecting openproject#localhost did not work, though root account has different user profiles (4 to be exact) allowing it to connect to both localhost and 127.0.0.1 .
TLDR version:
Use the statement as follows:
mysql -u openproject -h 127.0.0.1 -p
Should do the trick.
I'm having a trouble accessing the database in my godaddy account. I already created a database in phpmyadmin and a user in mysql database
I need to access the database in my godaddy account using my localhost.
But when i run my code, i'm getting a host xxxx is not allowed to connect to this mysql server
below is what i used in config
Public consqlonline As String = "server=Website_ipAddress;user=uname;password=pass;database=syncing;Connect Timeout=2000"
you need to give a privilege to connect the specific database that the application need to connect, via PHPmyadmin >> choose database >> use privileges tab.
by the way i had this problem also and my server was running on Linux, by default the configuration of the server permit connection only from localhost, so to fix that ive edited /etc/mysql/ my.cnf file: changed the bind-address from 127.0.0.1 to 0.0.0.0 (if the version is kind of old you have to comment the "skip-networking" command
Using MySQL Workbench in Windows 7 how can I bind my MySQL Server to my IP Address instead of 127.0.0.1 and how can I give users from different hosts access to it?
From here:
Open a DOS command prompt on the server.
Run the following command from the mysql\bin directory:
mysql -u root --password=
A mysql prompt should be displayed.
To create a remote user account with root privileges, run the following commands:
GRANT ALL PRIVILEGES ON . TO 'USERNAME'#'IP' IDENTIFIED BY 'PASSWORD';
It depends on hosting server on which the database is hosted e.g. by Hostgator hosting you may bind IPs to access the database remotely, you will have to provide access to user IPs in the hosting. For other like Go Daddy it depends on while creating the database, you will have to select for remote database option which generated a url likewise a host with which database can be accessed with SQLYog/Workbench.
My Answer is you can't bound the IPs with database tools but only with hosting servers.
I normally code on windows and using MYSQL4.1. And mysql gem version is 2.8.1. In my setup when I use mysql gem to access the MYSQL server, I give the root username and password of the sql server. And in rails db config file, I give user name as 'root' and its password and host as 'localhost'. My rails server and Mysql server are running on the same machine.
But recently I had to do a project in which I had to access the MYSQL server installed at a client site. It is a linux machine. I am not sure of the sql server's version number. To access it I was given a username and password for SSH and the root username and root password of the SQL server also. But for accessing that machine, in the mysql new method I have to specify the ssh login and user-password instead of sql user and password.
I cant access the DB if I give the MySql root user and password.
So, mysql.new(machine's public IP, ssh login id, ssh login password, db_name) works whereaes mysql.new(machine's public IP, 'root, root password, db_name) does not work. I am not sure, I understand what is happening. So, my question is can anyone explain this login behavior? Why cant I access the mysql server with the sql server's root login and root password.
To expand a little bit on what adamaig said:
When you're logged into the MySQL console as root, do this:
use mysql;
select User, Host from user;
MySQL should give you a table with the accounts and their respective hosts. You'll probably see that root can only log in from '127.0.0.1' or 'localhost'. You'll also probably see another account with credentials identical to those of the ssh account that was given to you.
Also, I would advise against giving root permission to log in from everywhere, it is a security risk.
But, if you ssh directly into the machine (using something like PuTTY if you're on Windows), you'll be able to log in as root from there.
Sounds like you need to create a user in the remote db that allows remote login. The root account is typically not given permissions to login from '%' . Try looking at the mysql.user table to see what the permissions are. Then you might want to look at the mysql.com developer documents on setting up accounts and security. The answers there will be fuller than can be given here.