login error mysql command line 5.6 - mysql

I installed mysql 5.6 on windows 7(32 bit).
When I open command line client 5.6 it asks me for password i put password (mysql) and press enter, it gives connection id number, meaning connection was successful. I created a database by the name bank
create database bank;
it was created.
I created the lrngsql database user with full privileges on the bank database using following command
Grant all privileges on bank.* to 'lrngsql'#'localhost' identified by 'xyz';
It was successful too. Now here my query begins, how do i login to this user (lrngsql). the command i m typing in prompt
mysql>use bank;
-- it says Database changed.
then i type following command to login to lrngsql
mysql -u lrngsql -p xyz;
but it gives me error please help me what should i exactly type in order to get in to lrngsql user on bank database. thank you

If you're already logged in, you need to log out in order to log in again with another user. You can cancel your connection with the quit command.
Just type quit in the prompt and the connection will be closed.

Related

Trouble Restoring MYSQL Database on CentOS Using SSH

I just had to change [dedicated CentOs] servers at Godaddy.
After I uploaded my .sql database backup file to the site using FTP, I connected to my site using SSH.
After changing to super user using the su - command, i tried using the following code to restore my database:
[root#sXXX.XXX.XXX.XXX ~]# mysql -u alaskasl_destiny -p alaskasl_freakout < /home/alaskasl/backup/databases/alaskasl_freakout.sql
I get the following ERROR 1044 (42000): Access denied for user 'alaskasl_destiny'#'localhost' to database 'alaskasl_freakout'
I can't figure out what I am doing wrong. This command has always worked for me in the past
First and foremost, if alasas1... is your real username, I would replace it with 'username'. Never give that info out, especially on a public place like Stackoverflow.
That said, a few things to check
1. You need to know the root user's login credentials for this new mysql instance. If this is a new setup the user is root with no password, so you should be able to use the following command:
$ mysql -u root
Once you do get in to mysql, you will see a prompt similar to:
mysql>
at that prompt you can type
mysql> show databases;
and a list of databases will display. Does the database you expect to be in there in there?
if not, here is what you need to do:
mysql> CREATE DATABASE 'database_name';
mysql> CREATE USER 'username' IDENTIFIED BY 'password';
mysql> GRANT ALL PRIVILEGES ON *.database_name TO 'username';
mysql> exit
At this point what you did was create the database, create a user with a password in mysql, and granted access to that database for that user. Once you type exit, you should now be back at the command prompt.
Now you can run mysql -u username -p database_name < /path/to/sql_file.sql

mysql command line unable to understand how to login

I installed mysql 5.6 on windows 7(32 bit). When I open command line client 5.6 it asks me for password i put password (mysql) and press enter, it gives connection id number, meaning connection was successful.
I created a database by the name bank
create database bank;
it was created.
I created the lrngsql database user with full privileges on the bank database using following command
Grant all privileges on bank.* to 'lrngsql'#'localhost' identified by 'xyz';
It was successful too.
Now here my query begins, how do i login to this user (lrngsql).
the command i m typing in prompt
mysql>use bank;
it says
Database changed.
then i type following command to login to lrngsql
mysql -u lrngsql -p xyz;
but it gives me error. please help me what should i exactly type in order to get in to lrngsql user on bank database.
mysql -u lrngsql -p xyz;
There should be minor change to command you have used for loggin in, there should not be any space in between -p and your password.
Like
mysql -u lrngsql -pxyz;

MySQL Workbench Cannot Connect to Database Server

I have exactly the same problem as the poster in question 7864276 except that in my case I've verified that the server is actually running, e.g., from within MySQL Workbench by right-clicking on Local Instance MySQL and selecting Start Command Line Client. It's only when I select Query Database or double click on Local Instance MySQL that the error message results. One additional piece of information in the error message is that it says "invalid for this platform requested(MYSQL_PROTOCOL_SOCKET)". Everything worked fine until I recently updated MySQL Workbench to version 5.2.47 CE.
Click on Manage Connections. Select Local Instance MySQL. Change Connection Method to Local Socket/Pipe. Test connection succeeds now.
TERMINAL:
sudo mysql -u root ENTER
you password user ENTER
USE mysql; ENTER
UPDATE user SET plugin='mysql_native_password' WHERE User='root'; ENTER
FLUSH PRIVILEGES; ENTER
exit; ENTER
service mysql restart ENTER
you password user again ENTER
finish you terminal, and enter Mysql Workbench, in Mysql Connections "key icon", local instance 3306, and Test connection.

mysql user login

I have created a user Sam with password mypass for my database db.
How to login with this user.
I want to check the privileges privided to this user.
I am using MYSQL 5.5
i am using windows 7. mysql command line.
Logging in is as simple as:
mysql -u Sam -p
You should then be prompted for your password. At this point, you'd either have to select a database to do operations on it or you could check your grants in general.
Checking user privileges is as simple as:
SHOW GRANTS FOR CURRENT_USER;
I would highly recommend reading MySQL :: Getting Started with MySQL.

unable to change to different user in mysql

I am also using windows 7.I installed mysql server 5.1.
Created a user as 'user#localhost' using mysql console. But unable to login to that user.
I tried to run using command prompt.
When I created a user with name "user". when i tried mysql -u user -p
It says Access Denied to 'user#localhost' ..
Even trying with mysql console is not helping out here. .
A few things to try:
Make sure your user has the correct privileges set (global or schema level privileges)
try running FLUSH PRIVILEGES
To help us troubleshoot, what does this command return? SHOW GRANTS FOR 'user'#'localhost';