Unhandled rejection SequelizeConnectionError: ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server - mysql

Unhandled rejection SequelizeConnectionError: ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; consider upgrading MySQL client
Im on ubuntu with the latest mysql db using node, meteor.js framework and mysql npm package. On suspicion that my app needs administer rights (sudo), since mysql also requires sudo, I try and start the app as sudo which is when I get this warning:
jk#jk-Aspire-E5-521:~/Documents/garlic$ sudo meteor
[sudo] password for jk:
You are attempting to run Meteor as the 'root' superuser. If you are
developing, this is almost certainly not what you want to do and will likely
result in incorrect file permissions. However, if you are running this command
in a build process (CI, etc.), or you are absolutely sure you know what you are
doing, set the METEOR_ALLOW_SUPERUSER environment variable or pass
--allow-superuser to proceed.
Even with METEOR_ALLOW_SUPERUSER or --allow-superuser, permissions in your app
directory will be incorrect if you ever attempt to perform any Meteor tasks as
a normal user. If you need to fix your permissions, run the following command
from the root of your project:
sudo chown -Rh .meteor/local

https://github.com/mysqljs/mysql/issues/1507#issuecomment-242885003
This appears to be mysql bug, restart the server after change. Changing password is unlikely to solve the issue.

Related

I can't start MySQL server in NodeJs after reset MySQL password using Windows's cmd

I reset my MySQL password using cmd commands from this guide.
cd "C:\Program Files\MySQL\MySQL Server 8.0\bin"
mysqld
--defaults-file="C:\\ProgramData\\MySQL\\MySQL Server 8.0\\my.ini"
--init-file=C:\\Users\\<username>\\resetMYSQL.txt
resetMYSQL contains a command to change password
ALTER USER 'root'#'localhost' IDENTIFIED BY '<myNewPassword>';
Now, it turned out I have to keep running the mysqld command above to start my server or else I'll get this error. If I run the command again I can flawlessly run my server until I terminate it.
This is the error. It's ECONNREFUSED.
I think my password is already reset, because apart from the command line, I also run ALTER USER in Workbench after I got access to it while the cmd is running.
Btw, before this I can just start my server using Node and Sequelize and didn't have to start server elsewhere or set anything beforehand
I'm not sure what is the problem here, so I don't know which keyword I should look up on Google. I googled the error code, but those cases seems unrelated to mine.
I'd be glad if you can explain me what's going on.
The nodejs error message you showed us, a ECONNREFUSED message with a traceback, shows the your mysql database server program was not running when your nodejs program tried to connect to it. Nodejs reaches out to MySQL via TCP/IP. TCP/IP responds "I don't know any MySQL." Specifically, it responds "ECONNREFUSED on port 3306," meaning "nothing on this machine accepts connections on MySQL's port."
nodejs does not start the mysql software for you. It connects to it and uses it.. MySQL has to be running already for that work.
Ordinarily, software like mysql runs in the form of a operating system service; a background process that runs all the time on the machine to await requests).
And, ordinarily, you don't provide init files to MySQL to do things like change passwords, except just once, if you must, to rescue something broken. In your case it looks like you forgot your MySQL password, so you needed to use an init file to rescue yourself. Once the password is reset, stop using that init file.
Explaining how to make MySQL run as a service on your machine is beyond the scope of a Stack Overflow answer. But the installers for MySQL, on almost every operating system, set it up to run as a service automatically. It's generally useless otherwise.

MySql 8.0.15 install failure Invalid Server Template

This is my first MySql install from the ground up.
I am using Windows Server 2016, trying to install MySql 8.0.15. I am doing this to try and use it with php 7.3.1.
The install has all the listed prerequisites.
When I get the config section of mysql insstaller, it breaks on the first response with an error of "Beginning configuration step: Writing configuration file
Invalid server template
Ended configuration step: Writing configuration file"
The system event log has one error, "The application-specific permission settings do not grant Local Activation permission for the COM Server application with CLSID
{8D8F4F83-3594-4F07-8369-FC3C3CAE4919}
and APPID
{F72671A9-012C-4725-9D2F-2A4D32D65169}
to the user NT AUTHORITY\SYSTEM SID (S-1-5-18) from address LocalHost (Using LRPC) running in the application container Unavailable SID (Unavailable). This security permission can be modified using the Component Services administrative tool."
But I'm not sure this is even the right troubleshooting path to start down.
Can you assist with some guidance?
I had the same problem with the
mysql-installer-web-community.
The mysql-installer-community was working without a problem.
The bottom link is the none web installer which was working.
For me initially when I was not accepting the initial update mysql pop-up then installer was not working, but once I accepted it. Then it successfully worked for me.
I have been able to install after getting the same error.
I have changed the credentials for the sql root.
By default, host is set to something like %ALL_HOST%. I changed to localhost.
I ended up uninstalling all mysql 8 components that had already installed.
Then went back and got the mysql installer 5.7.25.0. I think I had some trouble after that, but it wasn't the same error. I finally ended up installing mysql 8.0.15 by itself and it worked. Then I went back and did the connectors. Next the workbench. Finally docs and samples. Doing them one at a time seemed to go better. I am now up and running.
Here's what I did to fix the issue
completely removed mySQL Server and Workbench installations.
uninstalled the mySQL web installer. Restarted my computer.
ran the mySQL web installer again (only installing mySQL Server)
downloaded the mySQL Workbench installer to install Workbench separately

Apache cant connect to mysql

I have Centos 6 with MySQL 5.7 installed
when i restart computer and trying to access web site i recive next error:
Software error:
Can't connect to the database.
Error: Access denied for user ''#'localhost' to database 'bugzilla_DB'
Is your database installed and up and running?
Do you have the correct username and password selected in localconfig?
if i connect to server and restart HTTPD service all start working untill next restart.
i checked:
1. mysql starts a lot before httpd
2. waiting few minutes after server starts not help until i make httpd restart
3. mysql.pid and mysql.sock are ok
4. selinux disabled
5. iptables not used and disabled
6. no additional error in mysql.log
This seems to be related to your web site source code trying to access MySQL.
You need to enter the right connection (host and port) info and user credentials in your source code (wherever authentication is made).
This has nothing to do with (the erratic premise) that Apache connects to MySQL. It does not (in any normal out-of-the box installation).
This being said, you should still provide more information, the following statement requires more facts about your setup:
if i connect to server and restart HTTPD service all start working untill next restart.
I Found the problem. RiggsFolly was right. the problem in local config.
when HTTPD starts as service with boot that is limited environment and correct user required. when i make service restart after boot i logging in and service uses correct user environment and connects to MySQL as that user. so proper configuration of localconfig fixed the problem.
thanks to all of you.

Connecting to mysql from cygwin issue

I am trying to debug something larger and I noticed that I can not properly connect to mysql from cygwin. I run the command by providing the host, user and password, and the only output is the error:
Warning: Using a password on the command line interface can be insecure.
after which it just idles.
interesting is that when i run
which mysql and I go to that path with the command prompt from windows and run the same command everything is ok.
Some console applications that weren't compiled using Cygwin may work incorrectly inside Cygwin's terminal. MySQL client is probably one of them. To use MySQL client with Cygwin, I'd install one from official Cygwin's repositories rather than trying to use native Windows MySQL. (Note that this doesn't mean installing whole server, just the client.)

Remote mySQL connection throws "cannot connect to MySQL 4.1+ using the old insecure authentication" error from XAMPP

I'm running a local copy of WordPress on XAMPP/WinXP for development, but would like to maintain a connection to the remote database. I keep getting "Error establishing database connection" no matter what I try.
On the same PC, I can connect to the remote mySQL DB using any number of mySQL clients, and on the mySQL side, the both the user and the database are set to accept incoming requests from any wildcard domain. I can also easily ping the remote database server from my PC (though I don't know how to do it from WITHIN XAMPP).
Is XAMPP its own little universe that can't reach through to the outside world? Or is there something I'm clearly overlooking that's not letting me connect?
Errors
Warning: mysql_connect() [function.mysql-connect]: Premature end of data (mysqlnd_wireprotocol.c:553) in C:\xampp\htdocs\dbtest.php on line 5
Warning: mysql_connect() [function.mysql-connect]: OK packet 1 bytes shorter than expected in C:\xampp\htdocs\dbtest.php on line 5
Warning: mysql_connect() [function.mysql-connect]: mysqlnd cannot connect to MySQL 4.1+ using the old insecure authentication
Edit
Thanks to #Michael for suggesting I just create a simple connection script so I can get better insight into the actual error that's being thrown. This revealed that it had to do with the old_password setting in mySQL. See my Answer below for a full description of how to resolve this issue.
Here's the test script I put inside my xampp\htdocs folder and tested out:
<?php
$mysqli = new mysqli('my.server.address', 'user_name', 'password', 'database_name');
if ($mysqli->connect_error){
die ("Connect error: " . $mysqli->connect_error );
}
I'm not really clear on why this became an issue on my XAMPP installation, since I'm also running PHP 5.3.x on the server's local box and wasn't experiencing those issues there. However, it has to do with my mySQL server running in "old password" encryption mode. Newer versions of PHP won't allow those kinds of connections, so you need to update your mySQL server to use the newer password encryption. Here are the steps, assuming you have control over the mySQL server. If you don't, that falls out of the scope of my knowledge.
locate the configuration file for the mysql server called my.cnf. I found mine at /etc/my.cnf. You can edit it with sudo nano /etc/my.cnf
Look for a line that says old_passwords=1 and change that to old_passwords=0. You have now told the server that the next time it is run, and it is asked to encrypt a password using the PASSWORD() command, it use the new 41-character encryption rather than the 16-character 'old' style encryption
Now you have to restart your mysql server / service. YMMV, but on Fedora that was easily done with sudo service mysqld restart. Check your OS' instructions for restarting the mysql daemon or service
Now we have to actually edit our user table within mysql. So open up an interactive shell to mysql (on the server you can type mysql -uYourRootUsername -pYourRootPassword)
Change to the mysql database. This is the database that holds all the good stuff for server operation and authentication. You must have root access to work with this database. If you get an 'access denied' you're SOL. Sorry. use mysql; will switch to that database
Now we want to update the user that was giving you grief. Ultimately you'll probably want to update all your users, but for now, we're just focusing on the user that threw the error. update user set Password=password('YOUR_PASSWORD') where User='YOUR_USERNAME';
Now you just need to tell mysql to use the new password for authentication when that user attempts to connect. flush privileges;.
You should be good to go!