<div dir="ltr"><div class="gmail_default" style="font-family:'courier new',monospace;color:rgb(0,0,0)">I've never used ConfigParser either, but shouldn't the "[client]" section have the options "mmz", "pass1", or "localhost" somewhere?  Do you need to add them to that file?</div>

</div><div class="gmail_extra"><br clear="all"><div><b>Matt Jones</b></div>
<br><br><div class="gmail_quote">On Mon, May 6, 2013 at 2:20 PM, MMZ <span dir="ltr"><<a href="mailto:programmer.toronto@gmail.com" target="_blank">programmer.toronto@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

On Monday, May 6, 2013 3:11:33 PM UTC-4, Jerry Hill wrote:<br>
<div class="im">> On Mon, May 6, 2013 at 3:01 PM, MMZ <<a href="mailto:programme...@gmail.com">programme...@gmail.com</a>> wrote:<br>
><br>
><br>
><br>
> I am trying to backup database on CentOS linux server,I'm getting error when running the following script. anyone can help?<br>
><br>
><br>
><br>
><br>
</div><div class="im">> Traceback (most recent call last):<br>
><br>
>   File "./backup.py", line 8, in ?<br>
><br>
>     username = config.get('client', 'mmz')<br>
><br>
>   File "/usr/lib/python2.4/ConfigParser.py", line 511, in get<br>
><br>
>     raise NoSectionError(section)<br>
><br>
><br>
><br>
</div><div class="im">> I've never used ConfigParser, but that  <br>
><br>
> error message looks pretty simple to interpret.  You've set up a ConfigParser object, told it to read in ~/my.cnf, the asked for the value of section 'client', option 'mmz'.  The error indicates that your config files doesn't have a section named 'client'.<br>


><br>
><br>
><br>
> What is the content of your ~/my.cnf file?<br>
><br>
> --<br>
><br>
><br>
> Jerry<br>
<br>
</div>Thank you for helping Jerry. Actually I found this script for debian but I want to use it for CentOS server so I replaced /etc/mysql/debian.cnf with ~/my.cnf<br>
the file content is:<br>
<br>
 Example MySQL config file for medium systems.<br>
#<br>
# This is for a system with little memory (32M - 64M) where MySQL plays<br>
# an important part, or systems up to 128M where MySQL is used together with<br>
# other programs (such as a web server)<br>
#<br>
# MySQL programs look for option files in a set of<br>
# locations which depend on the deployment platform.<br>
# You can copy this option file to one of those<br>
# locations. For information about these locations, see:<br>
# <a href="http://dev.mysql.com/doc/mysql/en/option-files.html" target="_blank">http://dev.mysql.com/doc/mysql/en/option-files.html</a><br>
#<br>
# In this file, you can use all long options that a program supports.<br>
# If you want to know which options a program supports, run the program<br>
# with the "--help" option.<br>
<br>
# The following options will be passed to all MySQL clients<br>
[client]<br>
#password       = your_password<br>
port            = 3306<br>
socket          = /tmp/mysql.sock<br>
<br>
# Here follows entries for some specific programs<br>
<br>
# The MySQL server<br>
[mysqld]<br>
port            = 3306<br>
socket          = /tmp/mysql.sock<br>
skip-locking<br>
key_buffer_size = 16M<br>
max_allowed_packet = 1M<br>
table_open_cache = 64<br>
sort_buffer_size = 512K<br>
net_buffer_length = 8K<br>
read_buffer_size = 256K<br>
read_rnd_buffer_size = 512K<br>
myisam_sort_buffer_size = 8M<br>
<br>
# Don't listen on a TCP/IP port at all. This can be a security enhancement,<br>
# if all processes that need to connect to mysqld run on the same host.<br>
# All interaction with mysqld must be made via Unix sockets or named pipes.<br>
# Note that using this option without enabling named pipes on Windows<br>
# (via the "enable-named-pipe" option) will render mysqld useless!<br>
#<br>
#skip-networking<br>
<br>
# Replication Master Server (default)<br>
# binary logging is required for replication<br>
log-bin=mysql-bin<br>
<br>
# binary logging format - mixed recommended<br>
binlog_format=mixed<br>
<br>
# required unique id between 1 and 2^32 - 1<br>
# defaults to 1 if master-host is not set<br>
# but will not function as a master if omitted<br>
server-id       = 1<br>
<span class="HOEnZb"><font color="#888888">--<br>
<a href="http://mail.python.org/mailman/listinfo/python-list" target="_blank">http://mail.python.org/mailman/listinfo/python-list</a><br>
</font></span></blockquote></div><br></div>