Closed. This question is not about programming or software development. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 days ago.
Improve this question
I installed MySQL in Windows WSL. I created a user & DB with
CREATE USER admin#localhost IDENTIFIED BY 'admin';
GRANT ALL ON *.* TO admin#localhost;
CREATE DATABASE test;
From command line I can connect using admin with
sudo mysql -u admin -p
but without the sudo I get
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (13)
With Workbench, I can connect to the test DB using admin/admin, but from NodeJS using mysql2 package (or Sequelize), I get Error: connect ECONNREFUSED ::1:3306
const mysql = require('mysql2/promise')
mysql.createConnection({ database: 'test', host: 'localhost', user: 'admin', password: 'admin' })
.then(console.log)
.catch(console.log)
Is sudo the problem? How can I connect from command-line or JS without sudo or see how Workbench does it?
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 6 years ago.
Improve this question
I have tried pretty much everything I could read on SO. I cannot connect remotely to my sql server. I can't even telnet to the correct port (3306). The connection just hangs. Here is a list of what I've checked/tried:
1) Privileges in mysql
I've run CREATE USER 'test'#'%' IDENTIFIED BY 'pass'; followed by GRANT ALL PRIVILEGES ON db.* TO 'test'#'%';and I flushed the changes.
2) Editing my.cnf
I edited the line bind-addressto be 0.0.0.0. I have made sure that the port is default (3306) and restarted the mysql service.
3) Checked firewall / that the ports are open
Using netstat -tnlp I checked that mysql is listening to port 3306.
To be sure, I turned off the firewall (i assume...?) using sudo ufw disableĀ“, and ufw status` returns "inactive".
HOWEVER Despite all of the above, I still can't connect to my mysql server remotely. I have tried running mysql -u test -p -h xxx but after entering my password the connection just hangs and I get "unable to connect to remote host, connection timed out".
In addition, as mentioned above, I have attempted telnet xxxxx 3306 from another server (where the x's denote the server IP of course), and the connection also just times out/hangs.
If you have anything else for me to try I'd LOVE to hear it.
Thanks in advance
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
In a new MySQL Workbench; while creating a connection It keeps giving me an error :
" Failed to connect to MySql at 127.0.0.1:3306 ; can't connect to MySql server on '127.0.0.1'(10061)
In my case I had a previous mySQL server installation (with non-standard port), and I re-installed to a different directory & port. Then I got the same issue. To resolve, you click on home + add new connection.
If you need to know the port of your server, you can find it when you start My SQL command line client via All Programs -> MySQL -> MySQL ServerX.Y -> MySQL X.Y Command Line Client and run command status (as below)
There is a difference between 127.0.0.1 and localhost. In all likelyhood your user is setup to access the database on "localhost". If that doesn't work, verify the user you're connecting with can access 127.0.0.1 via the CLI ( IE mysql -uroot -p -h127.0.0.1 ).
Its seams your database ie (mysql) not started,
check the mysql official documentation, how to start mysql server.
If you already install the mysql server follow the below process.
[Your mysql server installation directory location]/bin\mysqld" --install
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
Issue
I've setup a PC with Ubuntu 13.10, installed mysql-server-5.5.35 and phpmyadmin-4.4.0.9-1.
With phpmyadmin I created the users ''jeby6372'' & ''internal'', set a password and read/write/insert/delete global privileges for each of them.
I can't connect users but root against the Mysql server.
Feedback
jeby6372#mercure:~$ mysql --version
mysql Ver 14.14 Distrib 5.5.35, for debian-linux-gnu (x86_64) using readline 6.2
Connecting under root:
jeby6372#mercure:~$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 123
Server version: 5.5.35-0ubuntu0.13.10.2 (Ubuntu)
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
Connecting another user :
jeby6372#mercure:~$ mysql -u jeby6372 -p
Enter password:
ERROR 1045 (28000): Access denied for user 'jeby6372'#'localhost' (using password: YES)
The problem is the same with the internal user
here is a snapshot of my privileges configuration thru the phpmyadmin view:
As I created users thru the phpmyadmin, it may bug while updating passwords in the mysql database so I ran under MySql root:
mysql> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> SET PASSWORD FOR 'jeby6372'#'localhost' = PASSWORD('mypassword');ERROR 1133 (42000): Can't find any matching row in the user table
mysql> SET PASSWORD FOR 'jeby6372'#'%' = PASSWORD('alpha1237');
Query OK, 0 rows affected (0.00 sec)
mysql> quit
Any idea ?
I've the same configuration on other servers that runs Mysql 5.5.35 on Ubuntu 12.04 and they work fine.
Any suggestion ?
thanks for your help.
% does not include localhost. When connecting via sockets (or named pipes on Windows), the host is localhost; with TCP/IP connections that same host is referred to by 127.0.0.1.
So in your case, it's likely that the connection type is socket and therefore jeby6372#% doesn't match the connection attempt. This is the same reason the default MySQL installation comes with root#localhost and root#127.0.0.1; they're different connection types.
See #1044 - Access denied for user 'someuser'#'localhost' to database 'somedb' and https://dev.mysql.com/doc/refman/5.1/en/account-names.html
Hope that clears it up for you.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
I have a question for you stackers. I'm not so well renowned with server maintenance and admin configuration. My problem is that I wan't to grant read access for a user to my mySQL databases on a remote server that's hosted by a server company.
I'm connecting via ssh to my server and then trying to create a new user for the databases in root -> mysql.
The problem I'm having is that I cannon't seem to connect to the databases from any other ip than as a localhost on the server itself. The bin-adress in my.cnf is pointing to localhost.
Is there another way to do this? Or rather how do you do this?
I really appreciate your answers.
Log in to your remote server via SSH
Open the the my.cnf file in an editor. (On Ubuntu that is located at
/etc/mysql/my.cnf): sudo vi /etc/mysql/my.cnf
Find the bind-address setting under the [mysqld] section and
change it from localhost to your the public IP address of your
server.
Save your edit.
Restart MySQL: sudo service mysql restart
Grant access to the remote user by logging into mysql as root and executing these commands (obviously you'll need to replace the IP address, database name and remote username with the correct values):
mysql -u root -p mysql
mysql> update db set Host='999.999.999.999' where Db='MyDB';
mysql> update user set Host='999.999.999.999' where user='RemoteUsername';
mysql> exit;
More information can be found on this page.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
I have the problem of connecting with mysql on my debian server. I run mysql -u root and get the error message:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111)
Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists!
So I did and I ran the command sudo find / -type s and got
/run/proftpd.sock
/run/mysqld/mysqld.sock
Not /var/run/mysqld/mysqld.sock!
Im simply trying to set up a database server to test it. What should I do?
This question would be better asked on serverfault.com. However, the easiest way to do this (without confusing other Debian apps) would be to create (as root) a symbolic link to the sock file:
# ln -s /run/mysqld/mysqld.sock /var/run/mysqld/mysqld.sock
Connect with mysql -u root -S /run/mysqld/mysqld.sock, this should work.