I created a different user, when I try to log into mysql it will not let me. I think I am missing a step. I am using windows 7. When I log in it automatically asks me for a password. If I enter the root password I can use mysql. If I enter the password I have created for the user, I get an error I cannot read and the program exits. Do I need to first login as root then somehow log in as new user. I am very confused. The code I used to create the new user is here:
Trouble logging into mysql as non root
Try this:
>> mysql -u USERNAME -p
Press enter, and you'll be prompted for the password for USERNAME.
There is no mysql equivalent to Oracle's 'connect' statement in the sense that allows to switch a user once already logged in to a mysql console session.
You may have created the new user, but not given that user sufficient permissions on the database you're trying to manage.
Related
Is there a way to restrict users from accessing a particular database/schema within MySQL?
I want to create a database/schema that only I can access.
I also want to change the password of the "mysql" user but I do not see this user in the mysql.user table even though I was able to use this user to login to mysql.
I tried changing the password of the user by executing the statement -
mysqladmin --user=mysql --password=oldpassword password "newpassword".
But now I am not able to login this user altogether. I've tried both the old and the new passwords.
I am wondering if my changing this password can impact any mysql service running on the system.
For restricting table and schema you can use the GRANT, you can set permission for each user or group on a particular tables for more details :
Tutorial on Grant for mysql
For your access the answer is already on stackoverflow :How do I retrieve my MySQL username and password?
Hope that can help you
I've started learning PHP with MySQL and come across some preliminary doubts. Hope someone helps clarify them..
I've come to know that there is a default user account named 'root' with no password. I changed the default password. Now, using command prompt when I try to login to mysql using C:\xampp\mysql\bin\mysql it returns me with the default MariaDB[(none)] prompt, but won't let me create any database, unless I login using actual password I set as: C:\xampp\mysql\bin\mysql -u root -p after which it prompts me to enter my password.
Also, it doesn't display the databases I created from within the root user account when I use the command show databases;
Is there a way to enter the required password from within the MariaDB[(none)] prompt mode? or do I have to manually exit and re-enter using mysql -u root -p ?
Should I have separate user account per project?
How is phpMyAdmin related with this user account, because it never asked my password?
Thanks in advance. Will come up with more doubts as I go on.
How would create another user in my mysql database so another person who is working on my rails application can also get access to the server?
Most articles I found on the question tell me to type in a command like "mysql --user=root mysql -p" that requires a password (https://dev.mysql.com/doc/refman/5.7/en/adding-users.html)
Is there anyway around this?
You can simply create an user without giving a password.
create user 'xxx'#'localhost'
I have a question about a scenario i currently have. generally the process should work but i can't seem to login successfully afterwards. either getting an incorrect username/password combination or an "unable to select Database" error when logging in with any credentials.
to skip forward a bit i have shutdown the mysql server on the machine and restarted it with the command
/etc/init.d/mysqld --skip-grant-tables
then logged in with mysql -u root -p
obviously this lets me in straight away as it skips the permissions check.
My goal is to change the password on a for a user on a table.
Currently there are three databases on the server we will call them as follows.
INFORMATION_SCHEMA
mysql
gnb
There is a table in gnb called users which has a username an password field. it has a single entry called admin under username which i want to change the password for as that is where the web server pulls the data from.
i have successfully changed the password for this particular user with the command
UPDATE users SET Password=PASSWORD('MyNewPass') WHERE username='admin';
FLUSH PRIVILEGES;
And 1 row is affected and i can visibly see the password hash change. also flushing privileges.
here's where i run into my problem....
once i have reset the password and restarted the mysql server in a normal mode i navigate back to the web server login and attempt to log in with the details that i now have.
i'm met with a "unable to select database" error message.
i'm not sure if i have to do something prior to restarting the database? or do i also have to restart the apache web server? i have tried a mirage of different combinations of things but just can't seem to get it working. if i attempt to log in whilst still in --skip-grant-tables mode then i just get an invalid login attempt.
thanks in advance/
I'm stumped....
I think you may have a misunderstanding about how the MySQL authentication system works.
When an application (e.g. a PHP script) connects to MySQL, the user/password checks against the mysql.users table. It does not check any other table in another database, even if that database (gnb) is the database that contains your application's data.
The fact that you have a table called "users" in your gnb database has no bearing on the MySQL authentication system. Of course you can put any data you want into that table, but it won't be used by MySQL authentication.
You can change passwords with the SET PASSWORD command, or you can UPDATE the mysql.users table directly and then FLUSH PRIVILEGES.
for the future.
second table was storing passwords in MD5.
update the row without using any password commands. simply a row update and update it with the MD5 hash of the password i was wishing to use.
web server then recognized the MD5 string as being the correct password and i was able to gain access.
I have a mySQL database problem - I'm a newbie to this:
I've installed WAMP Server and I'm able to log into localhost then phpmyadmin to give the screen below (right image). But I get No xNo Privileges in red -- I see from online examples that I should see "Create new database":
Suggestions are welcome.
[I have no password and the login is just 'local']
You are getting this message because you have made up a userid and password.
MySQL's initial installation state has ONE userid defined called root.
This is the case regardless of how you installed MySQL, unless the install asks you for a password at installation time.
That is the SUPER USER and can do anything.
By default (again which ever way you install MySQL) this root user has no password.
So login to phpMyAdmin using :-
username = root
password = (leave this blank, empty)
Press the Login button.
You will now be loged in as root.
PS.
Its a good idea to add a password to this username, BUT PLEASE DONT FORGET IT, as recovery can be a pain.