I am trying to insert data into a cloudfoundry mysql database as follows:
vmc tunnel myapp --port 10000 mysql
Then:
mysql> source /home/julien/Documents/donnees/projets/Site-Rencontres/java/src/main/resources/misc/sql/geolocation.sql
ERROR 1142 (42000): INSERT command denied to user 'udYra*****'#'172.30.*.*' for table 'geolocation'
What strikes me is that the user I retrieved using java.lang.System.getenv("VCAP_SERVICES"); is different from the one above:
"user":"ukqM8******"
My question is twofold:
How can I prepopulate the cloudfoundry database with data?
Why is the above user different from the one I retrieved from the VCAP_SERVICES env variable?
EDIT: I was able to succefully connect to mysql using vmc tunnel's none option and then pointing to port 10000 from the mysql client. I am now running into mysql privileges issues and I opened another thread here on SO.
The reason the users are different is that Caldecott uses a different binding to the application where you inspected VCAP_SERVICES.
Related
I am trying to connect to an existing mysql database on a linux server and scaffold tables in my project and working with them via EFCore.
I use this command line to scaffold :
dotnet ef dbcontext scaffold "server={IP};port={PORT};userid={USER_ID};password={PASSWORD};database={DB_NAME};" Pomelo.EntityFrameworkCore.MySql -o Models -f
But it shows this error to me:
Host '{MY_IP}' is not allowed to connect to this MySQL server
I am using Pomelo.EntityFrameworkCore.MySql library on .NET Core 2.1 SDK
What should I do?
If your MySQL instance is bound to the public IP address (you can check this by doing 3306 port scan for that IP - assuming MySQL is running on the standard port) then you need to grant privileges on the database for the user you are using as follows:
GRANT ALL PRIVILEGES ON <yourdb>.* TO `<youruser>`#`<yourip>` IDENTIFIED by '<yourpassword>';
After you have run this you need to run the FLUSH PRIVILEGES; command. Assuming all above conditions are met you should be able to access your DB remotely.
There are 2 things to understand before trying to connect.
1) Generally, databases are allowed to listen to local machine, ie localhost.
2) databases as mysql authentication comes in pair i.e. user#host_name.
So changing the way DB want you are really screwing security.
Now here is the way you can change MySQL listen for rest of world.
1) go to **my.cnf**, Check ‘**bind-address**’, comment this line. it
must be bind with `localhost` or `127.0.0.1`.
2) go to database MySQL, table users, column host replace
`localhost` to `"%"`, so the anyone from anywhere can connect.
3) `CREATE USER ‘root’#‘%’ IDENTIFIED BY ‘some_pass’`;
4) `GRANT ALL PRIVILEGES ON *.* TO ‘root’#‘%’;`
5) `FLUSH PRIVILEGES;`
I am trying to configure my Linux server to create a staging environment for my Wordpress Multisite. I am trying to access the wp_options table to be able to make changes, but I'm getting a garbled mess of dashes when I attempt to "SELECT * FROM WP_OPTIONS".
To counter this, I am attempting to use MySQL Workbench to see if it tidies up the mess. However, while I see the database entitled "wordpress" when I SSH into the server (I'm using Google Cloud Platform as my host), I do NOT see the database when I use MySQL Workbench!
I'm running sudo when activating mysql in SSH, and I'm logging in as "root" when using MySql workbench, so the permissions should be the same.
Below is the comparison between the SSH and what I'm seeing after running a "SHOW DATABASES;" command between them:
How can I get the wordpress database to show up in MySQL Workbench???
Edit 1: I have ruled out that this is a permissions issue- using SELECT_CURRENTUSER(); I see that I am logged in as the exact same account in both (root#%), so despite having the EXACT same permissions I am getting different tables showing.
You should consider logging in through your root session and then updating your permissions to view the database as the correct user, from whatever server you'd like.
GRANT ALL PRIVILEGES ON <Database Name>.* TO '<Username>'#'%';
I'm unable to create a schema on freshly set-up MySql Cluster 7.4.7 on single windows machine. It fails with error ERROR 1044 (42000): Access denied for user ''#'localhost' to database 'my_schema'. What is it that I'm missing? During installation I was not asked for username and password for MySql, so what are the defaults?
Also to give detail on how I set-up (in case that is not proper), I following this tutorial and using default settings on new cluster wizard, I have been able to successfully run 2 Multithreaded data node (ndbmtd.exe), 1 Management Node (ndb_mgmd.exe), 2 SQL Node (mysqld.exe). I also stopped mysql server 5.5 running on my machine previously. Then, using command line and typing mysql I'm able to connect and show databases; result in 2 schemas:
information_schema
test
Thanks in advance.
After further trying, I've been able to get away with both the problems above:
Instead of create schema, I used create database and it worked.
By default there is no password. I'm able to connect with user as root without any password.
Weird issue. Can't connect to localhost MySQL database from command line, but I can through MySQL program, Sequel Pro. Any ideas why? I entered the same user/password, but I'm getting a access denied error for root#localhost
Extra question: can you run MySQL commands within Sequel Pro? I'm pretty new to MySQL, but I'm just trying to change a simple column definition.
EDIT: reset password from within Sequel Pro query for root, and was able to get it working.
MySQL has different accesses. You can allow a MySQL database to only serve requests from a specific machine, or only from the local machine.
However, note that MySQL differentiates login from "localhost" and from "127.0.0.1".
Try allowing both localhost, 127.0.0.1 and "%" to the account.
I am running Centos6 with Plesk 11 and I am trying to assign a single user to have access to multiple databases. I am following the instructions given here: http://kb.parallels.com/en/115783
When I run the command GRANT ALL PRIVILEGES ON newdb.* TO 'olduser'#'%'; from the SQL tab in phpmyadmin, I am getting the following error:
1044 - Access denied for user 'openemm2'#'%' to database 'openemm_cms'
openemm2 is the username I have assigned to this database -- why the error and what can I do about it?
Found the solution to this. I had to log into the mysql> prompt using:
mysql -uadmin -p`cat /etc/psa/.psa.shadow`
This allowed me access to run the command. I have also discovered one can accomplish the same thing through the phpmyadmin panel access through the database servers link from the servers tab in Plesk 11. This is where you find the master phpmyadmin where you can access ALL of your databases rather than the individual access phpmyadmin you get through the database link in the websites & domains tab.