How To Set Up Database Replication In MySQL

Discussion in 'HOWTO-Related Questions' started by cruz, Oct 30, 2007.

  1. cruz

    cruz New Member

    Were can I find the exampledb.sql file on the main server so I can move it over to the slave server?
     
  2. volksman

    volksman New Member

    If I'm not mistaken you will need to "dump" the db into a file and then move it...

    mysqldump -u root -p <dbname> > outputfile.sql

    Should do the trick.
     
  3. cruz

    cruz New Member

    Yes I have folowed the howto Database Replication In MySQL . It asks the move the file to the slave server. But I do not know were it was stored after it was created on tha main server.
     
  4. volksman

    volksman New Member

    well the command I put in the last post:

    mysqldump -u root -p <dbname> > outputfile.sql

    dumps it to a file called outputfile.sql in the current directory (where ever you are). You can modify that so that it puts it where you like IE:

    mysqldump -u root -p <dbname> > /home/cruz/outputfile.sql

    would put it in your home directory....
     
  5. cruz

    cruz New Member

    Thank you

    I did not understand that. Thank you for that info. I will do that. I was thinking, do I need to add the root password to this after the P?
    mysqldump -u root -ppasssword databasename databasename.sql
     
    Last edited: Oct 31, 2007
  6. volksman

    volksman New Member

    you can but its best practise to not as it will be stored in your bash history...so any knowledgable hacker can look through your history to gain your passwords (once they have access to your box)...

    if you leave it without the password after the -p it will prompt you for it when you run the command....
     
  7. cruz

    cruz New Member

    thanks

    I thank you for helping me out. I do understand about the password.
    P.S. I had to ask this question. If the password can be found from hackers, why dose the how to have the password in it if the people that wrote the how to are Linux minded people? Or is it necessary to have set up in the how to the way it is?
     
    Last edited: Oct 31, 2007
  8. volksman

    volksman New Member

    It's really a matter of paranoia and ease of documentation. In order for someone to see your bash history they need access to the box (or if you are silly enough to expose it somehow). The risk is minimal and for ease of documentation it is much easier to put the password in the command.

    Ripping through a howto line by line is not a guarantee to a secure and reliable system. It's just a helpful map. You still need to find your own way home. :)
     

Share This Page