Hello folks,
Please advice.
I have migrated one of my servers from MySQL to MariaDB and I see that the IDs in DB are starting from 1 again. As I already have records in my apps
created with MySQL this will overcome with double IDs .
Please advice how to deal with this!
Thank you very much.
Migrate form MySql to MariaDB
Migrate form MySql to MariaDB
AwareIM 8.5, 8.7, 9.0 - MariaDB, Windows Server 2012,2019, 2022 Standard
-
- Posts: 2418
- Joined: Mon Jul 02, 2012 12:24 am
- Location: Ulaanbaatar, Mongolia
Re: Migrate form MySql to MariaDB
Maria DB uses Sequences so have a look in your DB and you should see a table called bas_idgen_seq.
Now you need to know what the highest ID number was that you had previously in idgen file on MySQL.
Let’s say it was 14,508
Once you know that….
Park on the bas_idgen_seq table and run the following query on the DB
ALTER SEQUENCE BAS_IDGEN_SEQ RESTART WITH 15000
The 15000 is any number greater than you previous 14,508
Now you need to know what the highest ID number was that you had previously in idgen file on MySQL.
Let’s say it was 14,508
Once you know that….
Park on the bas_idgen_seq table and run the following query on the DB
ALTER SEQUENCE BAS_IDGEN_SEQ RESTART WITH 15000
The 15000 is any number greater than you previous 14,508
Cheers,
Mark
_________________
AwareIM 6.0, 8.7, 8.8, 9.0 , MariaDB, Windows 10, Ubuntu Linux. Theme: Default, Browser: Arc
Upcloud, Obsidian....
Mark
_________________
AwareIM 6.0, 8.7, 8.8, 9.0 , MariaDB, Windows 10, Ubuntu Linux. Theme: Default, Browser: Arc
Upcloud, Obsidian....
Re: Migrate form MySql to MariaDB
That's seems to work.
Thank you Mark.
Thank you Mark.
AwareIM 8.5, 8.7, 9.0 - MariaDB, Windows Server 2012,2019, 2022 Standard