search

Home  >  Q&A  >  body text

Python/MySQL cannot persist integer data correctly

No need for any code here. I want to save a very long number because I'm making a game and need to save scores. But I tested it and set the score to 25000000000 but saved it in mysql as 2147483647. I also modified the limit for integers and set it to an integer in mysql. Any ideas? If the number is under 10 digits it works, but if it is more than 10 digits, it doesn't work even if I modify the limit.

P粉025632437P粉025632437227 days ago501

reply all(1)I'll reply

  • P粉293341969

    P粉2933419692024-04-05 16:53:14

    Use BIGINT data type instead.

    According to the MySQL documentation, the INT type only supports signed values ​​between -2147483648 and 2147483647, while the BIGINT type supports signed values ​​between -2^63 and 2^63 - 1 (-9223372036854775808 to 9223372036854775807).

    reply
    0
  • Cancelreply