My windows10 is not starting up but I have installed Ubuntu along with windows.
I have some mysql databases in my windows environment which I need backup so is there any way to open windows version of the databases in ubuntu so I can export that databases.
after handling JoSSte above comment you need to run these command in terminal
mysql -u user_name -p this command will ask for password
after successfull above command , you can check your database using below command
show databases;
if your database is there you can export database using below command
mysqldump -u your_db_user_name -p [database_which_need_to_export] > database_name.sql
this command will give you sql file then you can import it using command or in phpmyadmin
I have downloaded macOS 10.13 (x86, 64-bit), DMG Archive and install it on my Mac(10.13.6) but while accessing it in terminal it's not taking root password which I have set during the installation process.
I have checked system preference MySQL is running and trying to access MySQL by below command, though it's asking for the password but not taking it after trying it, its giving below error
sudo /user/local/mysql -u root -p
error : sudo: /user/local/mysql: command not found
You didn't install mysql there. Double-check where it's actually installed. You'll probably be able to use plain old mysql as the command name.
I'm unable to get access into mysql via terminal. I've installed MAMP on my MacOS High Sierra (10.13.5).
Apache & MySQL started, but after prompting the command:
/Applications/MAMP/Library/bin/mysql --host=localhost -uroot -proot
nothing happens.
P.S. Path leading to MAMP binaries is correct.
screen from terminal
Unfortunately, I didn't find solution at StOvfl.
I downloaded the mysql dmg file and went through the wizard to run. Done. I have also started mysql server under system preferences.
The purpose of me doing this is to work through the exercises of my SQL text book. The terminal commands are new to me but I think once I can actually get started, working through the exercises should be OK.
From researching the web the various blogs tell me to navigate to to the mysql folder in the terminal:
/usr/local/mysql
Fine. Then it gets a little less clear as nearly each article has a different set of instructions on how to proceed. I was fiddling with it yesterday and was prompted for a password - what is the default mysql password?
Could someone give me the steps to get up and running with mysql via the terminal?
(Updated for 2017)
When you installed MySQL it generated a password for the root user. You can connect using
/usr/local/mysql/bin/mysql -u root -p
and type in the generated password.
Previously, the root user in MySQL used to not have a password and could only connect from localhost. So you would connect using
/usr/local/mysql/bin/mysql -u root
open terminal and type
sudo sh -c 'echo /usr/local/mysql/bin > /etc/paths.d/mysql'
then close terminal and open a new terminal and type
mysql -u root -p
hit enter, and it will ask you for password
I have found this solution on https://teamtreehouse.com/community/says-mysql-command-not-found
now to set new password type
ALTER USER 'root'#'localhost' IDENTIFIED BY 'MyNewPass';
In the terminal, I typed:
/usr/local/mysql/bin/mysql -u root -p
I was then prompted to enter the temporary password that was given to me upon completion of the installation.
In MacOS, Mysql's executable file is located in /usr/local/mysql/bin/mysql and you can easily login to it with the following command:
/usr/local/mysql/bin/mysql -u USERNAME -p
But this is a very long command and very boring, so you can add mysql path to Os's Environment variable and access to it much easier.
For macOS Catalina and later
Starting with macOS Catalina, Mac devices use zsh as the default login shell and interactive shell and you have to update .zprofile file in your home directory.
echo 'export PATH="$PATH:/usr/local/mysql/bin"' >> ~/.zprofile
source ~/.zprofile
mysql -u USERNAME -p
For macOS Mojave and earlier
Although you can always switch to zsh, bash is the default shell in macOS Mojave and earlier and with bash you have to update .bash_profile file.
echo 'export PATH="$PATH:/usr/local/mysql/bin"' >> ~/.bash_profile
source ~/.bash_profile
mysql -u USERNAME -p
install homebrew via terminal
brew install mysql
This command works for me:
./mysql -u root -p
(PS: I'm working on mac through terminal)
In terminal
sudo sh -c 'echo /usr/local/mysql/bin > /etc/paths.d/mysql'
Close that and open new terminal
mysql -u root -p
Give your password
For mac OS Catalina :
/usr/local/mysql/bin/mysql -uroot -p
This will prompt you to enter password of mysql
You can simply type in Terminal
brew services start mysql
if you installed mysql via brew on mac
If you have your MySQL server up and running, then you just need a client to connect to it and start practicing. One is the mysql-client, which is a command-line tool, or you can use phpMyAdmin, which is a web-based tool.
This command works for me:
Command:
mysql --host=localhost -uroot -proot
try with either of the 2 below commands
/usr/local/mysql/bin/mysql -uroot
-- OR --
/usr/local/Cellar/mysql/<version>/bin/mysql -uroot
I have a sql command I want to use to connect to my online database
mysql -h your_ddbb_server_ip -u your_user
I've installed MySQL installer 5.5 and ran the program.
After installing I tried running the command from both command prompt and a program called 'MySQL 5.5 Command Line Client'.
Neither program responded to the command.
How and where do I run this?
From a command prompt (cmd.exe)
be sure you have the mysql bin folder in the path (the installer prompts for that) so you can just type mysql.exe (or just mysql).
Otherwise you have to navigate to the MySql bin folder (in my case that's C:\Program Files\MySQL\MySQL Server 5.5\bin
cd "C:\Program Files\MySQL\MySQL Server 5.5\bin"
mysql -h your_ddbb_server_ip -u your_user
This command will launch an interactive shell. If you just want to execute a command you have to specify the -e argument
mysql -h your_ddbb_server_ip -u your_user-e "SHOW DATABASES"