Q:

How can I change ID to Auto Incremental after making relationships in MySQL

I am trying to study MySQL and JDBC so I created a database. I didn't know that I had to make my ID's auto incremental. So when I was trying to create a function for inserting data in database in JDBC, I was told that the ID's should be auto incremental and I shouldn't add them manually. As I already have added all the data and structured the database(making relationships, adding foreign and primary keys) I can't make my ID's autoIncremental, because they are foreign keys in different tables. I don't wan't to delete data from my database and start from beginning. What are my options other than giving ID's manually in JDBC?
Can I somehow change my ID's and make them Auto Incrimental?
I think that me having foreign keys in other tables is the problem. But I don't want to delete them as I have put lot's of data in my database. 
This is the MySQL workbench. I tried to add. AutoIncremental from here.

The MySQL workbench applies this SQL script:
ALTER TABLE `university`.`student` 
CHANGE COLUMN `StudentID` `StudentID` INT(11) NOT NULL AUTO_INCREMENT ;

And Finally I get this Error:
ERROR 1833: Cannot change column 'StudentID': used in a foreign key constraint 'studentsection_ibfk_1' of table 'university.studentsection'
SQL Statement:
ALTER TABLE `university`.`student` 
CHANGE COLUMN `StudentID` `StudentID` INT(11) NOT NULL AUTO_INCREMENT

ERROR: Error when running failback script. Details follow.

ERROR 1046: No database selected
SQL Statement:
CREATE TABLE `student` (
  `StudentID` int(11) NOT NULL DEFAULT '0',
  `LastName` varchar(255) COLLATE latin1_general_ci DEFAULT NULL,
  `FirstName` varchar(255) COLLATE latin1_general_ci DEFAULT NULL,
  `StudentGPA` float DEFAULT NULL,
  `Major` varchar(255) COLLATE latin1_general_ci DEFAULT NULL,
  `MajorID` int(11) DEFAULT NULL,
  PRIMARY KEY (`StudentID`),
  KEY `MajorID` (`MajorID`),
  CONSTRAINT `student_ibfk_1` FOREIGN KEY (`MajorID`) REFERENCES `major` (`MajorID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci

P.S. Im working with MySQL Workbench, PHPMyAdmin and Eclipse for JDBC.

A:

You only have to make the id column a key and change the property to be autoincrement:
CREATE TABLE `test` (
    `id` INT NULL,
    `value` INT NULL
)
COLLATE='latin1_swedish_ci'
ENGINE=MyISAM;    

INSERT INTO `test` (`id`, `value`) VALUES (1, 23);
INSERT INTO `test` (`id`, `value`) VALUES (5, 42);

With the above code, I simulate a populated table with your values. Then, this is the code you're interested:
ALTER TABLE `test`
CHANGE COLUMN `id` `id` INT(11) NULL AUTO_INCREMENT FIRST,
ADD INDEX `Índice 1` (`id`);

After that, you'll have an autoincrement field, so you won't need to add the id again:     
INSERT INTO `test` (`value`) VALUES (23);

