MySql password for service Mysql#server-ip:3306 - mysql

I created a new user and when I try to connect to the db remotely via the new user I get this message and none of the passwords I use are correct. I can login to root no problem. I checked and port 3306 is open and everything since root works fine. I'm losing my mind over this.
message box

You can specify the host when creating a user on MySQL:
CREATE USER 'johndoe'#'localhost' IDENTIFIED BY 'somesupersecurepassword';
Replace localhost for your public IPv4.
For testing, you can replace localhost for %, which should allow all hosts.
CREATE USER 'johndoe'#'%' IDENTIFIED BY 'somesupersecurepassword';

Related

How to gain access back to root (admin) user in MySQL?

I had one admin user with username = root (had admin privileges) and password =admin then i created new user with username =root (have no privileges) and password =root. but what happened now I have lost access to root user(admin) and i am able to access only root user which is newly created.now i am unable to do anything with this newly created root user. it show access denied for every operation. so is there any way to gain access to root(admin) user or give admin privileges to new root user or reset databases and start by new. I tried many solution but none of them worked for me.
Complete account name includes both username part and host part. See Specifying Account Names and the difference between USER() and CURRENT_USER().
Check complete names for both root accounts. Then log in by the way which makes "old" root account matched one only.
For example, if "old" is 'root'#'%' and "new" is 'root'#'localhost' or 'root'#'127.0.0.1' then disable network connections (--skip-networking=ON in the service command line) and connect using named pipes or shared memory (on Windows) or Unix socket files (on Unix). Or connect to the server remotely.

Can't connect remotely without bind-address, can't connect locally with it

I'm having an issue with mysql. I am trying to allow remote access. I found that if I write in my.cnf:
bind-address=my.ip.address
It works remotely, but using a php script that tries to access the database using the same ip doesn't work anymore!
If I remove this line, I can connect locally, but not remotely.
I tried setting it to 0.0.0.0, which has the same effect as if it were not there at all.
I saw that you can't bind to multiple addresses unfortunately. Any way to resolve?
MYSQL User accounts have 2 parts
The userid
The domain from which they can connect to this MYSQL Server instance
EG 'root'#'localhost'
So you need to create a new user account, you dont want to give access to the root id externally, and make this new userid allowed to connect from either a specific ip address (more secure) or any ip address
From the command line mysql.exe processor you woudl do this
CREATE USER 'somone'#'11.22.33.44' IDENTIFIED BY 'mypass';
for a specific ip address
Or
CREATE USER 'somone'#'%' IDENTIFIED BY 'mypass';
To allow access from any ip adddress in the universe, so better make the password a good strong one
Then you allocate privilages to one or more databases to this new account
GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP
ON database_name.*
TO 'someone'#'%';
References
CREATE USER http://dev.mysql.com/doc/refman/5.7/en/create-user.html
Grant http://dev.mysql.com/doc/refman/5.7/en/adding-users.html

No privileges on xampp server phpmyadmin

As you can see, there is no privileges tab, and I can't a create new database
Usually this is because you're not actually logged in as the user you think you are, but as the anonymous user instead. Double check your username and password, and make sure the host field is matching for the account you're trying to log in to. For example, if you're able to connect through the command line client which connects over sockets, your host is 'localhost' but if phpMyAdmin is using the TCP connection type, your host will be 127.0.0.1 instead; these aren't the same to the MySQL permissions system. If you changed the root password for root#localhost but not root#127.0.0.1 it won't match the new password in this case.

MySQL server root user deleted, can't connect to server

Somehow I must have deleted the root user and now I am getting messsages that localhost cannot connect to the server so I pretty much can't do anything at the moment. I tried to reinstall the server but for some reason there is no root account created.
Is there some kind of hidden file on my computer that is disallowing connections from localhost despite me completely removing the server application?
Some have suggested using --skip-grant-tables and adding a root user but I just get a message that localhost can't connect to the server. It's madness, can't I just create another server instance with a root account or something?
You can create the root user using the method described in section C.5.4.1.1
http://dev.mysql.com/doc/refman/5.5/en/resetting-permissions.html
However, instead of an update of the password put the following SQL in the text file:
use mysql;
insert into user (Host, User, Password) values ('localhost','root','');
update user set Select_priv='Y',Insert_priv='Y',Update_priv='Y',Delete_priv='Y',Create_priv='Y',Drop_priv='Y',Reload_priv='Y',Shutdown_priv='Y',Process_priv='Y',File_priv='Y',Grant_priv='Y',References_priv='Y',Index_priv='Y',Alter_priv='Y',Show_db_priv='Y',Super_priv='Y',Create_tmp_table_priv='Y',Lock_tables_priv='Y',Execute_priv='Y',Repl_slave_priv='Y',Repl_client_priv='Y',Create_view_priv='Y',Show_view_priv='Y',Create_routine_priv='Y',Alter_routine_priv='Y',Create_user_priv='Y' where user='root';
flush privileges;

Question related to mysql gem new method authentication

I normally code on windows and using MYSQL4.1. And mysql gem version is 2.8.1. In my setup when I use mysql gem to access the MYSQL server, I give the root username and password of the sql server. And in rails db config file, I give user name as 'root' and its password and host as 'localhost'. My rails server and Mysql server are running on the same machine.
But recently I had to do a project in which I had to access the MYSQL server installed at a client site. It is a linux machine. I am not sure of the sql server's version number. To access it I was given a username and password for SSH and the root username and root password of the SQL server also. But for accessing that machine, in the mysql new method I have to specify the ssh login and user-password instead of sql user and password.
I cant access the DB if I give the MySql root user and password.
So, mysql.new(machine's public IP, ssh login id, ssh login password, db_name) works whereaes mysql.new(machine's public IP, 'root, root password, db_name) does not work. I am not sure, I understand what is happening. So, my question is can anyone explain this login behavior? Why cant I access the mysql server with the sql server's root login and root password.
To expand a little bit on what adamaig said:
When you're logged into the MySQL console as root, do this:
use mysql;
select User, Host from user;
MySQL should give you a table with the accounts and their respective hosts. You'll probably see that root can only log in from '127.0.0.1' or 'localhost'. You'll also probably see another account with credentials identical to those of the ssh account that was given to you.
Also, I would advise against giving root permission to log in from everywhere, it is a security risk.
But, if you ssh directly into the machine (using something like PuTTY if you're on Windows), you'll be able to log in as root from there.
Sounds like you need to create a user in the remote db that allows remote login. The root account is typically not given permissions to login from '%' . Try looking at the mysql.user table to see what the permissions are. Then you might want to look at the mysql.com developer documents on setting up accounts and security. The answers there will be fuller than can be given here.