how to run mysql in ubuntu through terminal
NickName:Raj Singhania Ask DateTime:2012-06-25T19:19:15

how to run mysql in ubuntu through terminal

trying to run mysql in ubuntu typing mysql in terminal and getting error

ERROR 1045(28000): Access denied for user 'root'@'localhost' (using password: NO)

Can anybody please sort out this problem...

Copyright Notice:Content Author:「Raj Singhania」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/11188351/how-to-run-mysql-in-ubuntu-through-terminal

Answers
lorenzo-s 2012-06-25T11:21:43

You have to give a valid username. For example, to run query with user root you have to type the following command and then enter password when prompted:\n\nmysql -u root -p\n\n\nOnce you are connected, prompt will be something like:\n\nmysql>\n\n\nHere you can write your query, after database selection, for example:\n\nmysql> USE your_database;\nmysql> SELECT * FROM your_table;\n",


matcheek 2012-06-25T11:23:45

If you want to run your scripts, then\n\nmysql -u root -p < yourscript.sql\n",


John Kane 2012-06-25T11:27:55

You need to log in with the correct username and password. Does the user root have permission to access the database? or did you create a specific user to do this? \n\nThe other issue might be that you are not using a password when trying to log in.",


Prakhar Agrawal 2015-11-30T14:23:17

You seem to just have begun using mysql.\n\nSimple answer: for now use\n\n\n mysql -u root -p password\n\n\nPassword is usually root by default. You may use other usernames if you have created other user using create user in mysql. For details use \"help, help manage accounts, help create users\" etc. If you dont want your password to be shown in open just press return key after \"-p\" and you will be prompted for password next.\nHope this resolves the issue.",


More about “how to run mysql in ubuntu through terminal” related questions

how to run mysql in ubuntu through terminal

trying to run mysql in ubuntu typing mysql in terminal and getting error ERROR 1045(28000): Access denied for user 'root'@'localhost' (using password: NO) Can anybody please sort out this problem...

Show Detail

How to use phpmyadmin mysql database using terminal in ubuntu 10.4?

Can any one help me to use phpmyadmin mysql database through terminal. I am using ubuntu 10.4. I guess the command like this /opt/var/usr/ mysql. I'm not sure about it.

Show Detail

How to import database through terminal ubuntu?

I want to import database in phpmyadmin mysql from terminal ubuntu. Can anybody give me command to insert such large size database?

Show Detail

Connecting to mySql through Terminal

I tried to follow valet installation with larval but I eventually gave up. It just wasn’t working with all my google powers. I’ll just work with MAMP PRO. I got it working. I want to run some ter...

Show Detail

MySQL Change Password command run in MySQL on Ubuntu Server results in strange Character Changes in terminal

I'm running an Ubuntu Server with MySQL in VirtualBox and trying to change the password for a user. I run: sudo mysql -u root -p to access MySQL. At this point, and with any other commands not try...

Show Detail

Is it possible to run ubuntu terminal commands using DJango

I am designing a simple website using DJango and my database is HBase. In some Part I need to save some files on HDFS, for example video file, and have it's URI. But my problem is I couldn't find a...

Show Detail

VSCode terminal in ubuntu wsl

I've run into an issue where when I open vscode through WSL (command code.) it opens VSCode with no terminal whatsoever and there's no option to open one. Terminal on WSL Ubuntu: But when I run vs...

Show Detail

How to run a MySql script in Ubuntu?

I'm using Ubuntu 16.04 and I'm able to use MySql from the command line fine. I can create a db, add tables, add rows to tables, get queries etc. What I can't do is write an sql file and run it. ...

Show Detail

How to make Sublime Text 3 compile and run java through terminal on Ubuntu

I am trying to create a Sublime Text 3 build system to compile and run my java code through the terminal on Ubuntu, not the built in window in the bottom of the Sublime window which i circled in re...

Show Detail

Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock when running flask app from terminal

There are literally tons of answers, which involve installing mysql-server in ubuntu. But I am using XAMPP and I am able to access mysql server through browser. I want the convenience of both PHPmy...

Show Detail