MySQL - How to increase varchar size of an existing column in a database without breaking existing data?
It's safe to increase the size of your varchar column. You won't corrupt your data.
If it helps your peace of mind, keep in mind, you can always run a database backup before altering your data structures.
By the way, correct syntax is:
ALTER TABLE table_name MODIFY col_name VARCHAR(10000)
Also, if the column previously allowed/did not allow nulls, you should add the appropriate syntax to the end of the alter table statement, after the column type.
I normally use this statement:
ALTER TABLE `table_name`
CHANGE COLUMN `col_name` `col_name` VARCHAR(10000);
But, I think SET will work too, never have tried it. :)
I'd like explain the different alter table syntaxes - See the MySQL documentation
For adding/removing defaults on a column:
ALTER TABLE table_name
ALTER COLUMN col_name {SET DEFAULT literal | DROP DEFAULT}
For renaming a column, changing it's data type and optionally changing the column order:
ALTER TABLE table_name
CHANGE [COLUMN] old_col_name new_col_name column_definition
[FIRST|AFTER col_name]
For changing a column's data type and optionally changing the column order:
ALTER TABLE table_name
MODIFY [COLUMN] col_name column_definition
[FIRST | AFTER col_name]