Avatar of BToTheAToTheBABA
BToTheAToTheBABAFlag for United States of America asked on

Mysql Import db dump Warnings/ Errors write in a file.

Hi

Im importing my database from mysql server version 5.0.4 to new mysql 5.5.8.

I have some 300 tables & I have used mysqldump to get the full dbSQL files.

Now in the new mysql server console Im choosing database & importing data from full sql files like this.

mysql>  source ./fulldump.sql

While doing this I'm getting a lot of warnings particularly in the middle of import.
But since this import runs fast in console window & the final lines of import has no warnings.
So I couldn't see the full warnings/messages of the import.(Cant issue show warnings command at right place)
It doesn't contain errors, but it has ONLY warnings.

HOW SHOULD I REDIRECT THE CONTENT OF WARNINGS TO A LOG FILE WHILE IMPORTING ?
SoftwareMySQL Server

Avatar of undefined
Last Comment
BToTheAToTheBABA

8/22/2022 - Mon
theGhost_k8

before using SOURCE use tee

mysql>tee `file_name' ;
after you finish ur SOURCE command,
mysql>notee;
Umesh

Hi,

Instead of mysql prompt most of the people prefer shell prompt while importing SQL(logical dumps)/Text(load files) ....prefered mostly on UNIX* like systems..which applies to CYGWIN too.. Just to ensure everything is logged incase mysql prompt hangs

/path/to/mysql -uUserName -pPassword DbName < /path/to/filename >>/path/to/error_warn.log 2>&1

## Change the /path/to/ to reflect actual paths in above command
ASKER
BToTheAToTheBABA

hi,

Thank you for the reply.

This method

/mysql  < sqlfile >> /logfile

Prints only the number of warnings.

The actual warning message is viewed by the command
mysql> show warnings;

When ever a warning occurs I want to issue a "show warnings" command & redirect the output to log file.
How to do this ?

Thanks again.
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
Umesh

Giving a try on this.. let u know the same
But As per my knowledge, there isn't any settings in MySQL which logs SQL statement warnings/errors to any log file(ofcourse mysql does provde a option to create a group in optional file to include [warnings] but it actually logs aborted connects etc warnings and not the SQL statement errors encountered whil loading the data)
theGhost_k8

I assume warnings will be logged in to error logs by default...
ziycon

That is all that should be needed, it will output any text to the logfile that is created during running on the current command.

/mysql dbname < sqlfile >> logfile.txt
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
ASKER CERTIFIED SOLUTION
Umesh

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Umesh

@theGhost_k8:

Yes, MySQL logs all the warnings to the error log but only with respect to the server utlilities or config file related matters such as if you include any deprcated syntax in optional file or the settings related to replication such as if you forget to give relay file/index details etc.

Unfortuately, MySQL doesn't record on file any warnings occured at the time of data load(logical or text etc)... Long back I saw MySQL reporting even failed SQL attempts on Update query log(now General query).
theGhost_k8

@ushastry sorry I overlooked that !!
Umesh

@theGhost_k8:  

:-)... np!
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
ASKER
BToTheAToTheBABA

Thank You