Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MySQL Git Bash winpty mysqldump stdout is not a tty and stdin is not a tty

Tags:

mysql

git-bash

Please help with MySQL Git Bash winpty mysqldump. "winpty mysqldump" is not working in Git Bash. Here the details of the error:

Git Bash

$ winpty mysqldump -u root -p employeedb > "E:\Working\SQL\MySQL\MySQL-Queries\mysqldump\SQL-dump\employeedb_backup.sql"
stdout is not a tty

$ winpty mysql -u root -p employeedb < "E:\Working\SQL\MySQL\MySQL-Queries\mysqldump\SQL-dump\employeedb_backup.sql"
stdin is not a tty

However Git CMD works fine:

Git CMD

C:\Users\Aspire>mysqldump -u root -p employeedb > "E:\Working\SQL\MySQL\MySQL-Queries\mysqldump\SQL-dump\employeedb_backup.sql"
Enter password: ****************

C:\Users\Aspire>mysql -u root -p employeedb < "E:\Working\SQL\MySQL\MySQL-Queries\mysqldump\SQL-dump\employeedb_backup.sql"
Enter password: ****************

Git Bash works with winpty mysqldump and winpty mysql without ">" and "<"

$ winpty mysqldump -u root -p employeedb

Enter password: ****************
-- MySQL dump 10.13  Distrib 5.7.14, for Win64 (x86_64)
--
-- Host: localhost    Database: employeedb
-- ------------------------------------------------------
-- Server version       5.7.14-log

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

--
-- Table structure for table `employee`
--

DROP TABLE IF EXISTS `employee`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `employee` (
  `ID` int(11) DEFAULT NULL,
  `Name` varchar(50) DEFAULT NULL,
  `Salary` decimal(15,2) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `employee`
--

LOCK TABLES `employee` WRITE;
/*!40000 ALTER TABLE `employee` DISABLE KEYS */;
INSERT INTO `employee` VALUES (1,'A',10000.00),(2,'B',8000.00),(3,'C',8000.00),(4,'D',6000.00),(5,'E',6000.00),(6,'F',6000.00),(7,'G',5000.00),(8,'H',5000.00),(9,'I',5000.00),(10,'
J',5000.00),(11,'K',4000.00),(12,'L',4000.00),(13,'M',3000.00),(14,'N',3000.00),(15,'O',1000.00),(16,'P',14000.00),(17,'Q',14000.00),(18,'R',12000.00),(19,'S',12000.00),(20,'T',160
00.00),(21,'U',16000.00),(22,'V',16000.00),(23,'W',14000.00),(24,'X',12000.00),(25,'Y',12000.00),(26,'Z',10000.00);
/*!40000 ALTER TABLE `employee` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;

/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

-- Dump completed on 2016-11-18 20:43:00

Please help with winpty mysqldump/winpty mysql and stdout/stdin tty?

Git Bash "mysqldump" without winpty does not work:

The command $ mysqldump -u root -p employeedb > "E:\Working\SQL\MySQL\MySQL-Queries\mysqldump\SQL-dump\employeedb_backup.sql" just freezes.

Please refer to the "employeedb_backup.sql" script size 0 KB.

enter image description here

Thanks

like image 308
Impavid Avatar asked Nov 18 '16 15:11

Impavid


1 Answers

I had a similar problem with git bash on Windows 10 (using the php command).

I fixed it by appending the extension (.exe) to php.

julien@SED-221-10 MINGW64 /c/xampp/htdocs
$ php -v > php
stdout is not a tty

julien@SED-221-10 MINGW64 /c/xampp/htdocs
$ php.exe -v > php

EDIT:

You can also add an alias if you don't want to append .exe to all your commands like so :

$ printf "\nalias mysql='mysql.exe'" >> ~/.bashrc
like image 170
Julien B. Avatar answered Sep 22 '22 07:09

Julien B.