In Ruby
db = DBI.connect("DBI:Mysql:database=db1:host=dbhostname:port=3307", "username", "password")
isn't working for me
using the same details in a direct mysql connection in the command line does...?
What am I missing to get the connection on port 3307 ???
I get the error:
Access denied for user 'username'#'localhost' (using password: YES) (DBI::DatabaseError)
changed order
DBI:Mysql:host=hostname;database=dbname;port=3307 worked for reason I don't really know.
Related
This is the error message I got after I tried to make a password and username for localhost and root. Please help me. I am using Mac by the way.
MySQL said: Documentation
Cannot connect: invalid settings.
mysqli::real_connect(): (HY000/1045): Access denied for user 'root'#'localhost' (using password: NO)
phpMyAdmin tried to connect to the MySQL server, and the server rejected the connection. You should check the host, username and password in your configuration and make sure that they correspond to the information given by the administrator of the MySQL server.
go to xampp\mysql\bin\my.ini and open it. change the port to 3307
and go to xampp\phpMyAdmin\config.inc.php and check the name of the host
$cfg['Servers'][$i]['host'] = 'localhost:3307';
Adding to soufiane's answer above, there is actually 2 more places where you have to make the same change:
xampp window: config > Service and Port Settings > mysql > Change port to 3307
add $cfg['Servers'][$i]['port'] = 3307; to phpMyAdmin\config.inc.php
For a complete start to finish solution, refer to this answer on Quora by Owais R. Mir: https://www.quora.com/How-do-I-change-the-port-of-a-MySQL-server-in-XAMPP/answer/Owais-R-Mir
PS:
I used this solution to run mysql from xampp on port 3307 because I had installed mysql separately before and it was using port 3306. When ports are reset for xampp mysql you avoid issues with initializing and signing in to your local database via phpmyadmin.
My problem is below:
C:\Users\ordek> mysql
ERROR 1045 (28000): Access denied for user 'ODBC'#'localhost' (using
password: NO)
C:\Users\ordek>mysql -u root
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using
password: NO)
C:\Users\ordek>mysql -u root -p
Enter password: ****
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using
password: YES)
I tried lots of solutions before asking here. I've even tried reinstalling MySQL but surprisingly this problem still exists. In Workbench I can't connect to any connection. I always login to the MySQL server as superuser and subsequent attempts to change privileges didn't work because I can't log into MySQL in the usual ways.
In Workbench it doesn't matter which user: root or not, you'll get this message.
[Window Title]
MySQL Workbench
[Main Instruction]
Cannot Connect to Database Server
[Content]
Your connection attempt failed for user 'user1' to the MySQL server at
127.0.0.1:3306:
Access denied for user 'user1'#'localhost' (using password: YES)
Please:
1 Check that MySQL is running on address 127.0.0.1
2 Check that MySQL is reachable on port 3306 (note: 3306 is the default,
but this can be changed)
3 Check the user user1 has rights to connect to 127.0.0.1 from your
address (MySQL rights define what clients can connect to the server and
from which machines)
4 Make sure you are both providing a password if needed and using the
correct password for 127.0.0.1 connecting from the host address you're
connecting from
In "test connection"(WORKBENCH) I always get this message:
[Window Title]
MySQL Workbench
[Main Instruction]
Failed to Connect to MySQL at 127.0.0.1:3306 with user user1
[Content]
Access denied for user 'user1'#'localhost' (using password: YES)
In my mind this is a problem with privileges, but I don't know what to do because I'm a beginner at MySQL. If you know how to overcome this problem, please let me know.
I believe you installed MySQL (windows) using .msi package. As it .msi allows you to do the installation step by step and you can set "root" password.
If you have root password, make sure MySQL services are started.
Control panel > services > Mysql
The user ordek seems unknown to mysql . Switch to root user and it will work .
If this is not possible , or the root password is unknown , re-install mysql , make a note of the root password for future use , create the ordek user and assign it the access rights it needs .
I have been trying since yesterday and somehow it's not working.
i dont know where am I going wrong with this.
here's the code in connections.js
module.exports.connections = {
mysql: {
adapter: 'sails-mysql',
host: 'localhost',
user: 'root', //optional
password: 'root', //optional
database: 'mysql' //optional
}
}
and here's the code in models.js
module.exports.models = {
connection:'mysql',
migrate:'alter'
}
could you guys tell me what's wrong here? and what's the reason for this error?
Here's the detailed error
error: A hook (`orm`) failed to load!
error: Error (E_UNKNOWN) :: Encountered an unexpected error
: Could not connect to MySQL:
Error: ER_ACCESS_DENIED_ERROR: Access denied for user 'root'#'localhost' (using password: YES)
at afterwards (/Users/faraz/code-playground/sailsapi/node_modules/sails-mysql/lib/connections/spawn.js:72:13)
at /Users/faraz/code-playground/sailsapi/node_modules/sails-mysql/lib/connections/spawn.js:40:7
at Handshake.onConnect [as _callback] (/Users/faraz/code-playground/sailsapi/node_modules/sails-mysql/node_modules/mysql/lib/Pool.js:54:9)
just wanted to show you the main page when I start mamp.
i think there's something wrong there
because it actually opens on http://localhost:8888/MAMP/?language=English but config shows port as 3306
could that be the problem??
here's a screenshot
I see that your configuration in sails is OK, so the reason why you cannot connect to the MySQL server is elsewhere. Here are some steps you may want to try:
Use phpMyAdmin to make sure you can connect to your server, but my guess is you will not be able to do that. If you do however, create a user for your DB there and grant all privileges for the DB to that user, and for host try to use "any host". Then adjust your connection according to that user.
In order to check your connection for the new user, the most convenient way is to use the MySQL Workbench tool from here: https://dev.mysql.com/downloads/workbench/
If all of that doesn't help, check this answer: Can't connect to MySQL server on 'localhost' (10061)
I am using 'mysql workbench' and 'xampp' server. I make the update to my database and try to view the results at 'localhost' and i get the error:
Could not connect: Access denied for user 'abc'#'localhost' (using password: YES)
I remember that when i was working with mysql i did some changes and i dont know what exactly i did...I was just playing around with it. I googled to solve the error and did the following:
mysql -u root -p hostname localhost - I logged in as root
use mysql;
select * from user;
This gives me four rows where i find the user 'abc'.
I open my browser and try to view my webpage on localhost and xampp throws the above error. Any help would be appreciated.
I have a problem using the heroku db:push command to transfer a MySQL database to heroku. I've tried using the same command for another app with a sqlite3 database and everything went fine.
C:\Users\reg\Team-Omni>heroku db:push
Loaded Taps v0.3.9
Auto-detected local database: mysql://127.0.0.1/omni_dev?encoding=utf8
Warning: Data in the app 'growing-mist-42' will be overwritten and will not be recoverable
.
Are you sure you wish to continue? (y/n)? y
Failed to connect to database:
Sequel::DatabaseConnectionError -> Mysql::Error: Access denied for user 'reg'#'localhost
' (using password: NO)
if i remove the password for the mysql anonymous account, the error changes to
Sequel::DatabaseConnectionError -> Mysql::Error: Access denied for user ''#'localhost' to database 'omni_dev'
--additional information--
my .gems file:
rails -v 2.3.8
andre-geokit --version 1.5.0 --source http://gems.github.com
You are getting that error because you are not specifying the password for the local database connection. Apparently the username is configured as 'reg' (maybe in the MySQL config file). This doesn't have anything to do with the Heroku PostgreSQL database, it's a problem connecting to your local MySQL database (named omni_dev).
Try the following connection string:
mysql://USERNAME:PASSWORD#127.0.0.1/omni_dev?encoding=utf8
for the appropriate values of USERNAME and PASSWORD.
I've had this problem as well, but I was passing a password. My local app worked fine, but when using heroku db:push, I got the same error as redge.
Adding a port in the database.yml fixed the problem. So, a working database.yml has the following entries:
database: DATABASE
username: USER
password: PASSWORD
adapter: mysql
encoding: utf8
socket: /Applications/MAMP/tmp/mysql/mysql.sock
port: 8889