freePBX CDR on remote database failing to connect - mysql

Morning all,
I have just finished a fresh install of freePBX and am trying to get the CDR to use a remote database without any luck.
I have tested the connection to the remote DB using mysql -u USERNAME -h REMOTE_IP -p'PASSWORD' and it connects fine. However when I try to get the CDR to work it fails out saying access denied to the user.
I have used the 'Advanced Settings' to change the remote CDR DB details and this has done nothing, I have also edited the amportal.conf and the odbc.ini and still nothing.
What the hell am I missing, I really need to solve this quick if I can.
Cheers,
Blinky

You need to give database permission to remote user:
grant all on your_database.* to username#'remote_ip' identified by 'password';

Related

Cannot preform mysql query from ubuntu terminal

What I'm trying to do:
I have a Minecraft server, I'm trying to my an admin panel so the other admins can help out the server more closely.
Right now, I am trying to make a live console. My thought was is that if I have a script fire off every 10 seconds the script would perform a MySQL query and upload the log file contents to the Database and then on the webpage is would display the rows.
What I have tried:
So I looked on StackOverflow and you can query MySQL databases from the Ubuntu terminal and I have tried that.
mysql -u username#Database -pPassword -h azure.database.for.mysql.url -P 3306 -D SchemaName
It does not work as I get an error
ERROR 1045 (28000): Access denied for user 'username'#'machineIp' (using password: YES)
There were people saying to edit the configs and comment out "bind-address" however it seems to only apply to the machine the MySQL server is on, and not the one performing the queries.
Things to note:
The Web Server, Minecraft Servers, and MySQL Server are all on different machines.
The MySQL server is a SaaS provided by Azure.
I use this database for my web server and it works fine in connecting to the server so I believe it is not a MySQL server issue.
I also use this database for my Minecraft permissions plugin and it connects fine.
If you have more questions please ask and I will do my best at answering them.
It looks like its not accepting your password.
This is the format that I use to access mysql from terminal.
mysql --prompt="(\u#\h) [\d]> " --user=your_username --password your_password

sudo user doesn't have correct mysql permissions

I am trying to use wp-deploy (which makes use of Capistrano) to deploy my Wordpress site to a Digital Ocean Droplet. I think I have everything configured properly but when I try to run the ...
bundle exec cap staging db:pull
... I get an error
SSHKit::Runner::ExecuteError: Exception while executing as sudousername#xxx.xxx.xxx.xxx: wp exit status: 127
(username and IP changed for privacy of course). So I SSH into my droplet and try to just connect to mysql using
mysql -u sudousername -p
and get the following error...
ERROR 1045 (28000): Access denied for user 'sudousername'#'localhost' (using password: YES)
I think this is because sudousername belongs to the sudo group and that group doesn't have permission to manage the DB?
I was hoping to find one of two solutions:
Grant the appropriate permissions to sudousername so it can do what it needs to on the DB
Pass along a second username and pass with Capistrano for the DB user (I created a user with phpmyadmin when I setup the database for Wordpress). The thought here being that when Capistrano is already SSH'd in and trying to perform functions on the DB it would use this other username and password.
I have looked for a solution for a couple hours now but I am a server n00b and haven't been able to find anything (and probably not sure what I am looking for).
Is anyone able to help? Thanks in advance!
I have figured out what the issue was. wp-deploy was using my sudo users credentials to SSH in and execute some shell commands. One of which was trying to use the WP Cli tool which I didn't have installed. Once I installed the WP Cli tool the scripts SSH'd in and ran wp db export and does so as the correct DB user. Thanks to #JuanTomas for helping me narrow that down.
For those that are having the same issue I also had to grant my DB user permissions for "LOCK TABLES'. Also, if you are using Wordpress 4.4+ you need WP Cli version 0.24 minimum or there will be compatibility issues. Use wp --info to check what version you have.

ownCloud Setup: SQLSTATE[HY000][1045] Access denied for user 'owncloud'#localhost' (using password:YES)

I wanted to setup my owncloud installation on my raspberry pi 2. So, I created an mysql database and user.
CREATE DATABASE owncloud;
CREATE USER 'owncloud'#'localhost' IDENTIFIED BY 'Password';
GRANT ALL PRIVILEGES ON owncloud. * TO 'owncloud'#'localhost';
FLUSH PRIVILEGES;
After I type all nessesairy parameters into the webinterface of the owncloud-setup, I recevied:
Error while trying to create admin user: Failed to connect the database: An exeption occured in driver: SQLSTATE[HY000][1045] Access denied for user 'owncloud'#'localhost' (using password:YES)
Sadly, my resent sreach on similar topics didn't result in any functional hint on this problem. So, I would be happy about further suggestions.
Look at this: https://doc.owncloud.org/server/9.0/admin_manual/installation/installation_wizard.html#database-choice
In Terminal: mysql_upgrade --force -u root -p
Use administrative MySQL »root«-user and password with the Installation Wizard
Check that the Database not exist which you create with the Installation Wizard
If nothing helps, start with sqlite, then migrate to mysql like this: https://doc.owncloud.org/server/9.0/admin_manual/configuration_database/db_conversion.html
Just replace localhost for 127.0.0.1 in Owncloud's setup form for MySQL as mentioned in comments above by Askaga
For some reason, explicitly re-access the database from the terminal solves the problem for me. Just give mysql an empty line with
mysql -u root -e ";"
This should be an individual command after you created database and database user.
Sure, you should always check whether
There are users with an empty username. Remove them.
Remove "test" database.
Grant appropriate permission to your database user.
Last but not least FLUSH PRIVILEGES;.
Search other posts for instructions. I'm just providing a possible solution if you come across a situation where none of the above works.
Here's a good example to properly setup mysql after installation. FYI.
Mask the DB password in the installation screen (the password should not be visible, only dots) and retry.
Ubuntu 18.04.1, Owncloud 10.
Check the contents of config.php in my case located at /var/www/owncloud/config/.
Specialy items dbuser and dbpasswrd.
Read config.sample.php in the same directory for info.

Access denied creating initial database- how do I grant the right access?

I'm making a new project on heroku, using mysql (they have an addon called JawsDB, which gives me a mysql host, username, password). (Update: I've also tried using their other mysql addon, ClearDB, and I have the exact same issue)
I can connect to the database like so (and I can 'show databases' to see what's there):
mysql -h izm96dhhnwr2ieg0.cbetxkdyhwsb.us-east-1.rds.amazonaws.com -u knu81lzn5m79u3rx -p[given_password]
Problem: When I do create database nptest, I get:
Access denied for user 'knu81lzn5m79u3rx'#%' to database 'nptest'
I've tried granting all privileges, like this:
grant all privileges on *.* to 'knu81lzn5m79u3rx'#'%' identified by '[given_password]';
but that gives me:
Access denied for user 'knu81lzn5m79u3rx'#'%' (using password: YES)
I also tried create user to make a fresh one, but of course then it's "Access denied" because I don't have create user privileges either.
What's the correct way to grant access to this user?
Ah! The answer was that the preliminary plan on jawsDB gives you one specific database (that has a cryptic name) on a shared server with other people, so you don't have permissions to make a new one. It wasn't clear in the instructions, so now I'm humming away with good old database "tbkrv66g085ulngi" :)
To further clarify on Diane's answer, the cryptic database name can be found by logging into JawsDB via a mysql client and runningshow databases or it's the last parameter of the JAWSDB_URL that can be found running heroku config.
i think if you use it in production mode it will solve the probl

Moved mysql DBs between mamp installations missing tables

I've been using MAMP out of convenience but have run into major problems after mistakenly changing root permissions. I have not been able to resolve these problems and have opted for a fresh install of MAMP and moving over the db folders, which I read was possible. In doing so, I have a number of DBs which have tables that are MIA.
SHOW GRANTS FOR 'root'#'localhost'
response:
GRANT ALL PRIVILEGES ON *.* TO 'root'#'localhost' IDENTIFIED BY PASSWORD '*81F5E21E35407D884A6CD4A731AEBFB6AF209E1B' WITH GRANT OPTION
GRANT PROXY ON ''#'' TO 'root'#'localhost' WITH GRANT OPTION
I can see the all the tables in the db folder but not all are not showing up in phpmyadmin.
I believe phpmyadmin connects as a socket "Server: Localhost via UNIX socket"
When I login into the console as root/localhost I can see all the tables.
Loggin into the console as root/127.0.0.1 I cannot see the DB at all.
I'm really stuck here and have pretty much lost a day of work because of this.
Update:
When I run mysql_update command I get the following response.
→ /Applications/MAMP/Library/bin/mysql_upgrade -p
Enter password:
Looking for 'mysql' as: /Applications/MAMP/Library/bin/mysql
Looking for 'mysqlcheck' as: /Applications/MAMP/Library/bin/mysqlcheck
Running 'mysqlcheck with default connection arguments
Running 'mysqlcheck with default connection arguments
ipbnew.ipb_admin_login_logs
Error : Table 'ipbnew.ipb_admin_login_logs' doesn't exist
status : Operation failed
ipbnew.ipb_admin_logs
Error : Table 'ipbnew.ipb_admin_logs' doesn't exist
status : Operation failed
I've posted a full explanation of the solution to my problem in a separate SO topic.
MAMP mysql broken root user