unable to connect cf ic login - containers

I am trying to have a container running in Bluemix. I have cf version 6.15, and I want to deploy a docker file I have a connection failed. Any experience around to help me with this? I appreciate in advance.
The commands I am running from windows are the following:
c:\build>cf login -u myusername -o myusername -s myspace
All authentication at this point is ok.
c:\build>cf ic login
And I have this error:
Client certificates are being retrieved from IBM Containers...
FAILED
Put https://containers-api.ng.bluemix.net:8443/v3/tlskey/refresh: dial tcp
198.23.117.148:8443: ConnectEx tcp: A connection attempt failed because the
connected party did not properly respond after a period of time, or
established connection failed because connected host has failed to respond.
In particular, I am trying to do the following coding which I followed step by step.
Also, this is a Windows 7 and I have no docker for windows installed (not sure it is needed). Many thanks!

Related

MySQL cli client hangs when connecting to Azure managed database

I have a MySQL database on Azure, using the Azure managed database service, and two Ubuntu 20.04 VMs (running PHP applications) in the same VNET. I can connect to the database from both PHP, and from a remote GUI client (SequelPro), so I'm confident the firewall is configured correctly and I'm using the right details.
However, when I try to connect using the mysql CLI client on either of the VMs, it just hangs with no output. I've tried on both VMs, I get the same behaviour.
The command I'm using is:
mysql -u "username#hostname" -p -h "ip_address" -P 3306 database_name -e "SHOW TABLES"
It prompts for the password, so I enter it... and then nothing. On top the mysql process is consuming 100% of CPU.
I can telnet port 3306 on the IP address, I get the usual gibberish asking for mysql_native_password.
If I change the hostname part of the username#hostname to an invalid hostname, then it says "The servername cannot be found". Whereas if I enter an invalid username (or an invalid password) then it hangs just the same. So I'm guessing this has something to do with the gateway part of Azure managed database service that's trying to resolve that name. Everything was working normally up until a few days ago.
There's nothing in any of the logs, and no output on the screen, so I can't work out where to begin trying to fix this.
This appears to be due to https://bugs.mysql.com/bug.php?id=105288 assuming your client is 8.0.27, i hit the same issue today.

Mac: Cannot connect to SQL server through Docker

I have an application which uses LocalDB and runs fine on a Windows PC, however I am trying to run this through my mac.... I'm struggling with connecting the application to a mySQL server which sits on docker. I have been following the other guides such as (https://learn.microsoft.com/en-us/sql/linux/quickstart-install-connect-docker?view=sql-server-ver15&pivots=cs1-bash) related to this topic with no luck...
Here's what I've done so far, through terminal:
sudo docker pull mcr.microsoft.com/mssql/server:2019-CU5-ubuntu-18.04
sudo docker run -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=<MyPassword123!>"
-p 1433:1433 --name sql_container
-d mcr.microsoft.com/mssql/server:2019-CU5-ubuntu-18.04
Verified this is running by using sudo docker ps -a
Also verified by using Kitematic, container seems to be running well
MySQL looks well set-up in System Preferences
I am able to connect to the container through Azure Data Studio using IP address as server name, as shown below
Within the Application, this is is what the ConnectionStrings look like within the appsettings.json folder...
However, when I run the application and try and hit the container, through a GET request OR on Swagger, I am met with the following reply; "error": "Cannot connect to SQL Server Browser. Ensure SQL Server Browser has been started."
I have researched this and tried the solution of including the port number after the IP number as such Server=(19X.XXX.X.XX, 1433) but this also comes back with the error; "error": "A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error: 25 - Connection string is not valid)"
I'm not sure where to go from here... any help to get this working would be greatly appreciated!
As trivial as it was, the correct syntax to make this work is Server=XXX.XXX.X.XX,1433
DO NOT INCLUDE PARENTHESES AND NO SPACE BETWEEN IP AND PORT

How do you set up MySQL in Docker and connect to it?

I'm trying to set up an e2e test. For this, I need a local test database, preferably in Docker so that test setup is simple. Here is a minimal project showing what I currently have: https://gitlab.com/MakotoE/mysql-test If this issue is fixed, npm test will finish with exit code 0. This is being run on Windows 10.
In main.js, I start an instance of the Docker image mysql:8.0 like this:
const command = 'docker run -e MYSQL_ALLOW_EMPTY_PASSWORD=yes -p 3306:3306 -d mysql:8.0';
ChildProcess.execSync(command);
I want to connect to it with mysql2, but it fails with an Error: connect ETIMEDOUT.
await mysql.createConnection({
host: 'localhost',
user: 'root',
});
If I try to connect to the database created in the JavaScript code, through command prompt (mysql -uroot), I get this error: ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial communication packet', system error: 0. If I create the container in command prompt with the same docker run command used in the code, I can connect successfully, so this issue might be related to ChildProcess.execSync, but I don't know how I can fix this.
How can I fix my code so that I can start a MySQL server in Docker and connect to it in Node.js running on Windows 10?
Edit: I'm not sure if this is related, but running this on Debian shows this error message when creating the container:
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock:
Post http://%2Fvar%2Frun%2Fdocker.sock/v1.39/containers/57f5b631e551466e1f9928ba62f7a5e2a5ad2a481da4686bda8684f1a71b8d7/stop: dial unix /var/run/docker.sock: connect: permission denied
And connection fails with ETIMEDOUT.
Edit: I added branch secondAttempt where I unsuccessfully tried running all commands outside the .js file, through NPM scripts. After running the test for this branch, you must manually stop the Docker container.
In the mysql -uroot command, it fails with:
ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial communication packet', system error: 0
which I believe is the same error as experienced previously, with different messages (due to different clients).
This experiment tells me two things: ChildProcess.execSync is not the root cause to this issue, and that there is something about this system (whether it is Docker, or the TCP connection to the Docker) that prevents scripted commands.
I finally figured this out. All I need to do is wait 15 seconds before connecting.
The mistake I made is a common one: not reading the readme. In the mysql Docker Hub page, under section "No connections until MySQL init completes", it mentions how you must wait for database initialization to complete. The example repos achieve this via looping to retry the connection, but I think its simpler to delay for a set period of time.
Before, I was under the impression that I only needed to wait ~1 second after docker run, but actually it takes ~14 seconds for the database to be initialized. The fix was as simple as using setTimeout to wait 15-20 seconds before connecting to the database. I have given an example in branch fixed!.

MySQL: Cannot start Service, Windows 10

I am aware that this question has been asked many times before, but all solutions I tried out did not work for me.
So, I installed MySQL Workbench and server. I log into Workbench as root. In the toolbar I click on Server then Startup/Shutdown and there I click on the button Start Server. But whenever I do this, I get following log:
018-05-14 21:09:59 - Starting server...
2018-05-14 21:10:07 - Server start done.
2018-05-14 21:10:09 - Checking server status...
2018-05-14 21:10:09 - Trying to connect to MySQL...
2018-05-14 21:10:09 - Can't connect to MySQL server on 'localhost' (10061) (2003)
2018-05-14 21:10:09 - Assuming server is not running
Addiotionally a popup appears which says:
Connect Error
Could not connect to MySQL: Can't connect to MySQL server on 'localhost' (10061)(code 2003)
One solution I found suggested installing the server manually. So I went into cmd as admin and typed:
C:\> "C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld" --install
It gave following output:
Service successfully installed.
But in Workbench the Server is still stopped and when trying to start it like mentioned above the same logs with the same popup and error appears.
Another solution I found suggested installing MySQL Notifier and using it to start and stop the server and use it to manage monitored items. But quite frankly, once I restart workbench and try to log in as root, it wont even log in but give following pop up error:
Cannot Connect to Database Server
Your conection attempt failed for user 'root' from your host to server at localhost:3306:
Authentication plugin 'catching sha2 password' cannot be loaded: Das angegebene Modul wurde nicht gefunden.
Please:
1 Check that mysql is running on server localhost
2 Check that mysql is running on port 3306 (note: 3306 is the default, but this can be changed)
3 Check the root has rights to connect to localhost from your adress (mysql rights define what clients can connect to the server from which machines)
4 Make sure you are both providing a password if needed and using the correct password for localhost connecting from the host adress you're connecting from
So now this "Authentication plugin 'catching sha2 password' cannot be loaded:" looks suspicious and I tried looking that up. I found this solution, which requires me to log into MySQL from cmd, but when I type C:\Program Files\MySQL\MySQL Server 8.0\bin>mysql -u root -p and execute it, it asks for the password which I provide, but then it answers with
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: YES)
Now I hit a wall and I don't know how to continue. The MySQL server still doesn't work and I am desperate.
Do you have SQL Server (MSSQL) instance installed on your machine? If so, this may cause an issue. MSSQL may "capture" port 3306. Try to stop MSSQL service and test MySQL.
The easiest way to resolve the error where the service does not start is by going into the registry as Administrator.
Navigate to HKLM\System\ControlSet001\Services\MySQL
Change image path to "C:\Program Files\MySQL\MySQL Server 8.0\bin\mysql.exe" --defaults-file=C:\Program Files\MyNewSQL\bin\MyNewSQL.ini MyNewSQL
My problem (same as yours):
Current Registry Setting:
C:\MySQLs\MySQLDev\bin\mysqld --defaults-file=C:/MySQLs/MySQLDev/MySQLDev.ini MySQLDev
Change Registry Setting to:
C:\MySQLs\MySQLDev\bin\mysqld.exe --defaults-file=C:/MySQLs/MySQLDev/MySQLDev.ini MySQLDev
Rerun "net start MySQLDev"
The MySQLDev service is starting.
The MySQLDev service was started successfully.
On Windows 10 and previous versions, you MUST give the User assigned to the MySQL service full permission of the MySQL folders.
I believe the newest version uses, User NETWORK SERVICES, therefore use File Explorer, right click on all of the MySQL folders, click on Properties, Security, Edit and give User NETWORK SERVICES full access of those folders.
Failure to do this will result in the Service starting and stopping due to errors which are visible if you use Command Line.

GlassFish can't connect to mysql (XAMPP)

I'm trying to connect my glassfish with a mysql server (installed via XAMPP) and it says:
Ping Connection Pool failed for jdbc/xxxx. Connection could not be allocated because: Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. Please check the server.log for more details.
My configs in glassfish are:
URL: jdbc:mysql://localhost:3306/SIRS
User: root
Password: xxxxxxx
Both servers are in the same pc running ubuntu.
I have the same configurations working properly in another pc but without XAMPP installation, I've installed mysql server with apt-get install mysql... command.
Any ideas why is this happening?
Thanks.
JB
One possibility is that mysql server & glassfish server are installed on the same host.
So, you should go to etc/mysql/my.cnf if there is a public ip address bind you should remove it and put only bind-address = 127.0.0.1
Another case is that in stead of URL: jdbc:mysql://localhost:3306/SIRS you should put
URL: jdbc:mysql://127.0.0.1:3306/SIRS
This worked for me.