I'm having a really annoying problem to connect to MySQL by Git Bash 2.5 (via Windows on localhost).
Everything works fine trough CMD and Mysysgit.
$ mysql -u root -proot
Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 7
Server version: 5.6.26-log MySQL Community Server (GPL)
Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
But, look at this. Git SCM for windows still stuck, blinking the cursor for ever and ever. Have you guys seen this? Anyone can help me?
$ mysql -u root -proot
Warning: Using a password on the command line interface can be insecure.
Thanks in advance.
the solution is provided here:
Git Bash mysql blank
use this winpty before any window command and it works.
winpty mysql -u root -proot
The issue 242 point out:
this is a known problem (see git-for-windows/build-extra/installer):
Some console programs interact correctly with MinTTY only when called through winpty (e.g. the Python console needs to be started as winpty python instead of just python).
If you do not like that, feel free to choose the installer option not to use MinTTY.
Please note also that Git for Windows is not your "Linux on Windows". It really is supporting Git on Windows and not necessarily mysql.
Using mysql in a docker container (like nkratzke/EasyMySQL) would be easier and provide a more manageable Linux environment.
Related
I have MariaDB (foobar_db) running in local environment in Docker. I have a SQL file some_sql_dump.sql that I want to run on this database. This is what I tried:
docker exec -t container_id_here mysql -u root -prootpass foobar_db < some_sql_dump.sql
This takes me into MariaDB's monitor:
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 11
Server version: 10.4.13-MariaDB-1:10.4.13+maria~bionic mariadb.org binary distribution
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [foobar_db]>
It seems like using the arrow (<) to pass in input from some_sql_dump.sql did not work correctly. Why did the arrow not work, and how can I make it run the SQL from the file?
I have just used the "--interactive , -i" option and it seems to work.
$ docker exec -i {container_id} mysql -u root -prootpass foobar_db < some_sql_dump.sql
I run mysql.server stop
then
$ mysql.server stop
Shutting down MySQL
.. SUCCESS!
And mysql configuration is like this. It seems to be stopped.
However, I can run mysql -uroot
$ mysql -uroot
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.15 Homebrew
Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
What is happening ?
I guess that two mysql are installed because I used homebrew to install mysql. If so, how to stop another one ?
if you want to make sure, you could always ps the MySQL process.
Also, you could check if the port to see if it's been occupied by the MySQL process.
I found the reason. I once run brew services start mysql.
So, even if i run mysql.server stop, soon mysql server restarted.
I disabled auto restart by brew services stop mysql
So I have just installed linux and started messing around with apache,php,mysql and I have this error when creating database. I was unable to find an answer so i hope you guys can help me.
max#MaxLNX:~$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 67
Server version: 5.5.47-0ubuntu0.14.04.1 (Ubuntu)
Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> create database firstdb;
ERROR 1006 (HY000): Can't create database 'firstdb' (errno: 13)
Error means that your mysql server doesn't have enough space.
Check the file system size, and remove unwanted software(s),or files.
There may be a permissions issue with the MySQL data directory. You could try setting the permissions as follows (adjust the path to your data directory)
chown -R mysql:mysql /usr/local/mysql/data
reply if it worked
Try using "sudo". On a Linux system, "sudo" means "superuser" and should help you gain access to make a database. Try this in your terminal:
sudo mysql -u root -p
I am trying to access mysql via command line, but when I enter the command to access my DB, I get the mysql --help text as an output. Here is what I am typing in:
mysql -h localhost -u USER -p PASSWORD DB_NAME
I have confirmed all of my credentials are correct, but when I run that, I get the following:
mysql Ver 14.14 Distrib 5.5.32, for Linux (x86_64) using readline 5.1
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Usage: mysql [OPTIONS] [database]
-?, --help Display this help and exit.
-I, --help Synonym for -?
--auto-rehash Enable automatic rehashing. One do...
I have also tried running it using php exec. I see the same output that way also. Anyone have any thoughts on why this is occurring?
Remove the space between your -p flag and your actual password, or use --password=PASSWORD. From the man page:
If you use the short option form (-p), you cannot have a space between the option and the password.
Don't include PASSWORD in the command. The "-p" is all you need. It will prompt you for the password without showing the characters you type.
So only when I go to my local PhpMyAdmin window, I get the #2002 message.
I searched the net and I found a terminal command to check if Mysql would be running in the first place and it does.
Running /Applications/MAMP/Library/bin/mysql -u root -p
gives me
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.5.9 Source distribution
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
That doesn't look bad I think so the error must not have much to do with that.
I read that there's the config.inc.php file where you replace the value 'localhost' with '127.0.0.1' but that didn't change the situation.
Then I went looking in MYSQL forums it is suggested to check the my.cnf file to check for certain values. but I can't find it anywhere. Is there another file that has the same function in MAMP?
Since the top-voted answer was hosted on Posterous, which no longer exists, this is a bit of an orphan. The content is archived at Archive.org but just in case that goes away, too, the linked answer was:
Today, I tried to install Mysql on OS X Lion using SQL Packager. I faced a very common issue:
MySQL Forums :: Install :: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
Turns out you can regenerate this file in the terminal with this:
ps -e|grep mysqld
sudo mysqld_safe
Thanks David Bocage for the tip.
Alright,
I finally got my PHPmyadmin page loaded again without getting the #2002 error. What I did is I kept reviewing the settings for the mysql socket file until at a certain point my phpmyadmin did show up the way it should. So I'm still not really sure why it happened.
I also noticed there was a portnumber mismatch between the actual port setting in MAMP (8888) and a certain php file I cant remember (where it was 3306) which set to match again. Can't be certain that this is what made it work though.
I had the same problem. Easy fix:
Go to /Application/MAMP/bin/phpMyAdmin/ and open up config.inc.php
on line 71 you see $cfg['Servers'][$i]['port']
For some reason the default ports got switched on my machine, so I set it to 8889. Save and phpmyadmin is back up and working!
Wooo