Not able to connect with mysql on linux(Cent OS) server - mysql

I am trying to connect mysql in my node js application. It's working fine into my local but when I tried to deploy application onto live server, I am not able to connect with the mysql.
My mysql credentials are correct, I tried by using below command:
mysql -u username -p
I also tried below command:
service restart mysql
But this command giving me error which is: "service will not execute and completion _service exists."
Don't know what's getting wrong. It's a fresh server which I bought yesterday. You can see the attached error
Can anyone please help with the same? Thanks in advance.

Related

Can't get my azure sql server up and running

I'm getting crazy over this issue, I hope someone can help me:
I created an Azure Database for MySQL server
Disabled SSL, and allowed all IPs to access
Trying to connect to the server using Server name and Server admin login name
I tried MySQLWorkbench, and CLI mysql -u <Server admin login name> -h <Server name> -P 3306 -p
In both cases it freezes, no error messages, doesn't timeout, no logs on the azure side.
I have literally no idea what's wrong or what to do about it. The database was just created, totally untouched.
Has anyone experiences something similar before?
Thank you!
With the given information it's not clear what is the exact error while accessing the database, but if you have deployed it properly you can access it easily without any error using both, MySQL Workbench and CLI.
In your example, the sequence of parameter isn't in write format which might giving issue.
Try below format:
mysql -h <server_name>.mysql.database.azure.com -u <admin_name>#<server_name> -p
If using MySQL Workbench, you can refer official document Use MySQL Workbench to connect and query data in Azure Database for MySQL for the same.
This should work.

MySQL.prefPane showing stop status

I have installed mysql using dmg from mysql website.
mysql-8.0.23-macos10.15-x86_64.pkg
package version: mysql-8.0.23-macos10.15-x86_64.dmg
I have connected to localhost server using: mysql connect -h127.0.0.1 -uroot
I am successfully connected and able to run operation/queries.
But not able to connect through django project. I suspect it is due to server not running. I am unable to understand when server is not running how i am able to connect from terminal.
UPDATE:
After reading answer on dba exchange I realised it might be because I
ran kill to stop mysql server.

New MySQL Workbench Install (Will not connect to root) Ubuntu 18.04

My newly installed MySQL workbench is refusing to connect to the root of my newly installed MySQL Community Server. Whenever I attempt to access "Local Instance 3306" (the default MySQL connection) I get the following error message.
This error message does change if I open "Local Instance 3306" via the "edit connection" tab and then "test connection". I'll get a different but similar error code.
I can access the server via the command line
and can confirm that the server appears to be active also via command line.
It is a fresh install of MySQLCommunity Server and MySQL Workbench running on Ubuntu 18.04 with only one user account. I installed both the server and workbench using apt and used the guide created by DevAnswers.co here.
After installing the server and workbench I attempted to access the server using the workbench BEFORE I ran the sudo mysql_secure_installation command. I got the same two errors. I then ran the secure installation command and assigned a password which I do remember and did input into the password field of mySQL workbench albeit with the same results. I am very new to mySQL and databases and am trying to install mySQL to learn how to use SQL. I'd appreciate any help you all can provide in resolving this issue.
Additional pictures:
and .
I suspect that you just need to follow this short guide to set a root password:
https://whs-dot-hk.github.io/ubuntu-18.04/install-mysql.html
After setting a root password, you should be able to connect to mysql-workbench.
In short the root user in MySQL is authenticated using an auth socket, not a password. That's what's giving the message you're getting in the first screenshot.
(I'm assuming this is for a development project, for a production project you should keep the default config)

Database connection failed.Can't connect to MySQL server on '192.168.1.9' (13)

I have my php application coding in 192.168.0.8 but the database is in 192.168.1.9. When i tried to connect in CentOS server its throws error as Database connection failed.Can't connect to MySQL server on '192.168.1.9' (13). but when i tried connect the same DB from my localhost then its working. Can someone help and save my day. I also tried editing etc/my.conf file but nothing worked.
I found issue. It is because httpd_can_network_connect was disabled by default. Now i have set to enabled using setsebool -P httpd_can_network_connect=1 and its working now. Thanks for you interest.

Can't connect to mysql. And mysql fails to restart

I have my websites on a VPS - CentOS. Suddenly all of them stopped working and are showing database connection error.
I have tried restarting mysql with the following command in SSH /etc/rc.d/init.d/mysqld restart but when it tries to stop it it says "Failed".
Any idea on what could I do?
Please check you mysql log file (/var/log/mysqld.log).