Edit a MySQL table structure
Structure changes work on MySQL and MariaDB sessions with Allow write turned on in the session’s Database settings tab. Production adds a confirmation checkbox to every change. Without Allow write, in a quick-connect tab, or after the session was edited to point to another host, port or login, structure changes are refused and the dialog says why. Every field, warning and statement: Table structure and Unicode.
Change a table
Section titled “Change a table”- Open the table (double-click in the Databases window), then Structure → Edit.
- Edit the draft: columns (name, type, UNSIGNED, ZEROFILL, NULL, default, ON UPDATE, AUTO_INCREMENT, generated column, character set, collation, invisible, comment, order), indexes (kind, columns, prefix length, DESC, invisible), foreign keys, CHECK constraints and options (engine, default character set and collation, ROW_FORMAT, AUTO_INCREMENT, comment).
- Review SQL… shows the exact
ALTER TABLEstatement(s), the session statements around them and warnings (dropped columns, type changes, NOT NULL on a column with NULLs, table size). ALGORITHM, LOCK and lock_wait_timeout rebuild the statement; a server that cannot honour them refuses with its error code. - Send runs exactly the shown statements; the first error stops the rest. Each statement is in the connection console with its time, affected rows, warnings, or error code, SQLSTATE and the server’s message.
Types are accepted only in the forms MySQL / MariaDB document (e.g. VARCHAR(255),
DECIMAL(10,2), ENUM('a','b')); defaults are text values, NULL or one of the offered
expressions (CURRENT_TIMESTAMP, UUID(), …). Generated columns and CHECK constraints take an
expression as typed, without ; or comments outside quotes.
A column or index the editor cannot restate (SRID, functional index parts, an unknown attribute) shows a lock icon: it is kept or dropped, changes go through the query editor.
If someone changed the table on the server after it was loaded, preparing or sending stops with
the structure … changed on the server: reload and edit again.
New, rename, duplicate
Section titled “New, rename, duplicate”Context menu of a database in the Databases window: New table…. Of a table: Rename…
(RENAME TABLE, also to another database), Duplicate structure… (CREATE TABLE … LIKE:
columns, indexes, CHECK and options, no rows, foreign keys or triggers).
utf8mb4
Section titled “utf8mb4”- Convert to utf8mb4… (table menu or utf8mb4… in the Structure view) builds
ALTER TABLE … CONVERT TO CHARACTER SET utf8mb4 COLLATE …with the server’s utf8mb4 collations. Before sending it lists: index columns over the key limit (767 bytes per column for ROW_FORMAT COMPACT / REDUNDANT, 3072 for DYNAMIC / COMPRESSED, 1000 per key for MyISAM), TEXT columns that grow to MEDIUMTEXT / LONGTEXT, a row over 65,535 bytes, unique keys that may get duplicates under the new collation, foreign keys whose other table must be converted too, and the table size with a rough copy time. - Default character set… on a database runs
ALTER DATABASE … CHARACTER SET … COLLATE …(new tables only). - utf8mb4 overview… lists the tables and columns of a database that are not utf8mb4, with Convert… per table.
Session during a change
Section titled “Session during a change”The browser’s session is read-only. For a change it sends SET SESSION TRANSACTION READ WRITE
(on MariaDB also max_statement_time = 0, since that limit covers DDL), the statements, then
SET SESSION TRANSACTION READ ONLY, and checks the session as after a query editor statement.
A session that cannot be verified is closed. Behind ProxySQL changes work only when ProxySQL kept
the read-only flag at login, and lock_wait_timeout is not set there. One statement may run up to
4 hours; the connection’s browser waits meanwhile.