Bash: mysqlimport command to write to database without prompt [duplicate] - mysql

This question already has answers here:
How do I import an SQL file using the command line in MySQL?
(54 answers)
Closed 4 years ago.
I'm trying to restore the empty DB for mydb table but the syntax of mysqlimport doesn't seem to be straight forward. I had earlier created the file emptyDbs when doing a mysqldump.
mysqlimport mydb/var/tmp/emptyDbs

mysql statsdb < /var/tmp/emptyDbs

Related

mysqldump comand showing blank [duplicate]

This question already has answers here:
mysqldump command not working?
(2 answers)
Closed 2 years ago.
I want to export large database using command line mysqldump but when i use the command mysqldump it shows blank and nothing happen.
mysqldump must be run from the regular shell, not inside the mysql program.
Type ; followed by Return to end the command you've started typing. You'll get an error because mysqldump is not a valid SQL query.
Type quite to get out of the mysql program and back to the normal command prompt.
Then type your mysqldump command line. You'll need to provide some arguments, such as the database and table names to dump.

import and export mysql table to xml file in windows command? [duplicate]

This question already has answers here:
Mysql XML table export command line
(2 answers)
How import xml files with mysql LOAD XML LOCAL INFILE
(2 answers)
Closed 3 years ago.
am using Mysql server version "MySQL Server 8.0".
please help me, how to export and import mysql table to xml file, in windows command prompt.
thanks.
Export
$ mysql -uroot -p --xml -e 'SELECT * FROM rajdb.Tablename' > /tmp/raj.xml
Import
mysql> LOAD XML /tmp/raj.xml INTO TABLE Tablename;

How may I copy all my existing application Data from sqlite3 to MySQL in Rails? [duplicate]

This question already has answers here:
Convert a Ruby on Rails app from sqlite to MySQL?
(5 answers)
Closed 5 years ago.
I am working on a project in Rails 4. I was using sqlite3 database previously. But now I want to switch the database from sqlite3 to mysql. But all my previous application data should be copied so when I use mysql database none of my table data may be deleted.
try this
1. cd /path/to/rails_app/db
2. sqlite3 DATA-BASE-NAME .dump > database.sql
3. mysql -u username -p -h localhost DATA-BASE-NAME < database.sql
Hope it will help you.

Accidentally dropped table from mysql server [duplicate]

This question already has answers here:
How do I restore a dump file from mysqldump?
(19 answers)
Closed 5 years ago.
I'm new to MySQL, and I accidentally dropped a table with approx 3gb worth of data. Good news, I think I have a backup file .dump. Now is there an easy way to import this file to my MySQL?
mysql -u username -p databse_name < backup.sql

BASH script not reading input mysql password [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
How to execute Mysql command from a shell script?
I'm trying to execute a .sql file using a bash script. But I am having a problem connecting to MySQL. Here's what I have so far:
#! /bin/sh
PWD="thepassword"
mysql -p -u theuser < Randomsqlfile.sql
echo $PWD
When the password is prompted, nothing fills out.
Make this:
mysql -utheuser -pthepassword <Randomsqlfile.sql