Storing an encrypted password to mysql in python
Question: 
    import sys
    import hashlib
    import getpass
    from passlib.hash import sha256_crypt
    import MySQLdb, random, os
    
    
    def SQLAddPass(username, password):
        SQL = 'insert into user values ("%s", "%s")' % (username, password)
    
        try:
            db = MySQLdb.connect (host='localhost', user='root', db='vedio')
            c = db.cursor()
            c.execute(SQL)
            db.commit()
            c.close()
            db.close()
            raw_input('Record Added - press enter to continue: ')
        except:
            print 'There was a problem adding the record'
            raw_input ('press enter to continue')
    
    
    def main(argv):
    
    
        print '\nUser & Password Storage Program v.01\n'
    
    
        username = raw_input('Please Enter a User Name: ')
        password = sha256_crypt.encrypt(getpass.getpass('Please Enter a Password: '))
    
        try:
            SQLAddPass(username, password)
    
        except:
            sys.exit('There was a problem saving Record!')
    
        print '\nPassword safely stored in ' + sys.argv[1] + '\n'      
    
    if __name__ == "__main__":
        main(sys.argv[1:])
    

My problem is that the script works but with the following error **

> (C:\Users\Elsie\Desktop\example.py:14: Warning: Data truncated for column
> 'passwo rd' at row 1 c.execute(SQL) Record Added - press enter to continue:

**

Password safely stored in database. What am i doing wrong any ideas or changes
to the code are welcome)


Answer: > Data truncated for column 'passwo rd' at row 1

Mean your table has a password column with a length of for example 10 and you
are inserting a record of let's say 20. The record you inserted will be
truncated. And passwords will be broken.

Increase length of column in the table

