Use python to regularly update Mysql Data

Source: Internet
Author: User
Using python to regularly update Mysql Data first describes this requirement: the server has two tables, album_item and album_item_inc. One is the full table, which is generated every morning and the other is the incremental table. Real-time update. I need to keep a full table and then update the incremental update every minute to this full table. 1. MySQL operation first, create a table and create a user: export the database table structure:
Mysqldump-usearch-p-B Album -- table album_item -- Port 3306> album_item. SQL
Then insert the database:
Mysql-uroot-psource <dir>/album_item. SQL

Today, I encountered a strange problem. When I used the grant statement to grant permissions, I reported an error and couldn't understand why. So I adopted a roundabout method: (1) in MySQL. insert the user into the user table (2) and then in MySQL. grant permissions to the user in the DB Table (3) Finally, use the command on the terminal to refresh the permission (flush privileges) and directly use grant select, delete, update, insert on album. * To search @ '%' identified by <password> 2. python code

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.