Thread: mysql command line option

  1. #1
    Registered User
    Join Date
    Oct 2006
    Posts
    3,445

    mysql command line option

    I seem to remember long ago using a command line option for the mysql command line client that allowed disabling of binary logging for the duration of the connection, but try as I might, I can't find any information about it. google only seems to return results about disabling it globally for the server, or as a command that is issued from inside the client. I want to restore a large database file, generated by mysqldump, but I'm concerned that the binary logs generated by the restore operation will exhaust my disk space.

  2. #2
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    5,108
    O_o

    Isn't `SQL_LOG_BIN' session based?

    Code:
    SET SQL_LOG_BIN=0;
    Also, make sure your environment stack (including any default directory configuration files) doesn't change this behavior.

    If it isn't, can you create a named pipe and redirect the log to that pipe and ultimately into trash? (I don't know what system you are on so can only speculate.)

    Soma

  3. #3
    Registered User
    Join Date
    Oct 2006
    Posts
    3,445
    yes, it's session based, but it's not a command line option for the mysql client program. it has to be executed after logging in. that doesn't help me when I'm executing a command like this

    Code:
    mysql -u user -ppass dbname < backup.sql

  4. #4
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    5,108
    O_o

    I'm thinking you don't have a recover protocol in place already?

    The protocol where I did some cable monkey work looked rather like this:

    Code:
    cat prologue.sql $(mysqldumpdb).sql epilogue.sql | mysql <???>
    You would do something like:

    Code:
    echo "set session sql_log_bin=0;"; cat $(mysqldumpdb).sql | mysql <???>
    Soma

  5. #5
    Registered User
    Join Date
    Oct 2006
    Posts
    3,445
    my linux console kung fu is still a little bit primitive. I don't know most of the common commands or tricks - just the basics really.

  6. #6
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    5,108
    ^_^

    I'm to lazy to actually make a meme, still: if you try to administer a "*nix" box without knowing the shell you are going to have a bad time.

    Soma

  7. #7
    Registered User
    Join Date
    Oct 2006
    Posts
    3,445
    fortunately, the amount of administration I have to do is also pretty limited. I don't have to do these restores very often. I'm just deploying a 3rd tier replication slave on an offsite virtual machine. I'll definitely keep your advice in mind for the future. I just don't have a lot of time to spend on learning console commands when most of my time is taken up writing code.

  8. #8
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    5,108
    O_o

    A completely untrue but useful rule of thumb: if you can do it in an interactive shell, it can be scripted.

    Soma

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 16
    Last Post: 09-25-2011, 12:37 AM
  2. Command line how to handle optional command.
    By ovid in forum C++ Programming
    Replies: 1
    Last Post: 03-07-2010, 11:41 PM
  3. mail command option
    By msenthil in forum Linux Programming
    Replies: 2
    Last Post: 06-03-2007, 01:05 PM
  4. MySQL Command
    By frankiepoon in forum Windows Programming
    Replies: 0
    Last Post: 11-20-2002, 07:40 PM
  5. problem passing an option as command line argument
    By papous in forum C Programming
    Replies: 3
    Last Post: 11-22-2001, 06:12 PM