简体   繁体   中英

How to Alter Table in the mysql?

I'm having a problem while ALTER TABLE . The reason am altering table is "Because of its length, this column might not be editable."

在此处输入图片说明

MySQL said: Documentation

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COLUMN description (MAX_ROWS = 1000000000 AVG_ROW_LENGTH=1000000000)' at line 1

My Sql Query

ALTER TABLE oc_information_description COLUMN description (MAX_ROWS = 1000000000 AVG_ROW_LENGTH=1000000000)

Should be the table length increase and don't truncate my data.

Your root problem is the following note on phpMyAdmin on column description :

Because of its length, this column might not be editable.

In this case the current data type TEXT is to small so there is no space to add more data to the field. You can change the data type with the following ALTER TABLE to a bigger one ( MEDIUMTEXT or LONGTEXT ):

ALTER TABLE oc_information_description MODIFY description MEDIUMTEXT

Your second issue is the wrong sql syntax (trying to solve the first issue):

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COLUMN description (MAX_ROWS = 1000000000 AVG_ROW_LENGTH=1000000000)' at line 1

You can't specify the AVG_ROW_LENGTH or MAX_ROWS for a specific column. You can specify them for table only. You can change these values with the following ALTER TABLE :

ALTER TABLE oc_information_description AVG_ROW_LENGTH = 1000000000, MAX_ROWS = 1000000000

table_options signifies table options of the kind that can be used in the CREATE TABLE statement, such as ENGINE , AUTO_INCREMENT , AVG_ROW_LENGTH , MAX_ROWS , ROW_FORMAT , or TABLESPACE .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM