skip to Main Content

ım working localhost, after my work end. I want a upload my db server phpmyadmin. But still syntax error how can ı fix this?

1064 – You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘(6) NULL DEFAULT NULL,
PRIMARY KEY (id) USING BTREE
) ENGINE = InnoDB AUTO’ at line 7 )

DROP TABLE IF EXISTS `veriler`;
CREATE TABLE `veriler`  (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `kullanici` varchar(60) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
  `gpa` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
  `durumu` int(10) NULL DEFAULT NULL,
  `miktari` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
  `tarih` datetime(6) NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;

2

Answers


  1. Try this simplified version:

    CREATE TABLE `veriler` (
      `id` int(11) NOT NULL AUTO_INCREMENT,
      `kullanici` varchar(60) DEFAULT NULL,
      `gpa` varchar(255) DEFAULT NULL,
      `durumu` int(10) DEFAULT NULL,
      `miktari` varchar(20) DEFAULT NULL,
      `tarih` datetime(6) DEFAULT NULL,
      PRIMARY KEY (`id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT;
    
    Login or Signup to reply.
  2. Support for fractional seconds in DATETIME values wasn’t added until version MySQL 5.6. If you can’t upgrade your server, you will need to remove the trailing (6) from the definition of column tarih i.e.

    `tarih` datetime NULL DEFAULT NULL,
    

    Note that you will lose precision in those values relative to your MariaDB server. If you need to store microseconds in your data values, you will need to upgrade the MySQL server to version 5.6 or later.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search