In addition to Weibo, there is also WeChat
Please pay attention

WeChat public account
Shulou
2025-10-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Recently modified the field length in the mysql database table. Execute the changed sql statement:
ALTER TABLE server_list MODIFY COLUMN server_lip CHAR (25)
Error message:
1 queries executed, 0 success, 1 errors, 0 warnings
Enquiries: alter table server_list modify column server_lip char (25)
Error code: 1833
Cannot change column 'server_lip': used in a foreign key constraint' server_history_ibfk_1' of table 'OMServer.server_history'
Reason: the server_lip field in the server_ list table is the foreign key of the server_history table, and the server_history table statement:
CREATE TABLE server_history (
ID int (11) NOT NULL AUTO_INCREMENT COMMENT 'primary key ID'
History_id int (11) NOT NULL COMMENT 'event ID'
History_ip char (15) NOT NULL COMMENT 'event IP address'
History_user char (15) NOT NULL COMMENT 'event username'
History_datetime datetime NOT NULL COMMENT 'event time'
Db_datetime timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'restocking time'
History_command char (255) NOT NULL COMMENT 'event Command'
PRIMARY KEY (ID)
KEY history_ip (history_ip)
CONSTRAINT server_history_ibfk_1 FOREIGN KEY (history_ip) REFERENCES server_list (server_lip)
) ENGINE=InnoDB AUTO_INCREMENT=27 DEFAULT CHARSET=utf8 COMMENT=' operation event table'
Resolution steps:
1. Lock table
LOCK TABLES server_history WRITE,server_list WRITE
two。 Check if it is locked
3. Release the server_history foreign key constraint
ALTER TABLE server_history DROP FOREIGN KEY server_history_ibfk_1
4. Change the server_ _ lip field length of the list table
ALTER TABLE server_list MODIFY COLUMN server_lip CHAR (25)
Check the table structure and find that the field length update has been completed.
5. New server_ foreign key constraint
ALTER TABLE server_history ADD CONSTRAINT server_history_ibfk_1 FOREIGN KEY (history_ip) REFERENCES server_list (server_lip)
6. Unlock
UNLOCK TABLES
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope





About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.