Server returns invalid timezone. Go to 'Advanced' tab and set 'serverTimezone' property manually.

3148 ワード

DataGrid接続MySqlデータベースエラー:
参照先:
MySQLエラー:Server returns invalid timezone.Go to 'Advanced' tab and set 'serverTimezone' property manually.
 
 
2、sqlをインポートするコマンドラインは以下の通りです:sourceパス名+/mytest_emp_dept.sql 
パス名に引用符を付けないでください
 
3、 Data too long for column 'userName' at row 1
解決:set userName utf 8; 
またはCREATE DATABASE IF NOT EXISTS databaseName DEFAULT CHARSET utf 8 COLLATE utf 8_general_ci;
2つ目の方法は、userNameなどの複数のフィールドが間違っている場合に便利です.1つ目の方法は面倒です.
参考:ERROR 1406(22001):Data too long for column'c_name' at row 1&&ERROR 1366 (HY000): Incorrect string
 
4、You are not allowed to create a user with GRANT
 
5、Column check constraint 'orders_chk_1' references other column.
解決:
Making check constraint in table level
CREATE TABLE orders
(
	#    
	orderNumber CHAR(32) NOT NULL  , 
	#     
	orderStatus CHAR(18) check (value in ('   ','   ','   ')) ,
	#      
	customerIDCard CHAR(18),
	#      
	roomNumber CHAR(6) NOT NULL,
	#     
	checkInTime DATE NOT NULL,
	#     
	checkOutTime DATE NOT NULL,
	#     (      ,      )
	totalMoney INT UNSIGNED NOT NULL,
	#      
	waiterID VARCHAR(10) NOT NULL,
	#   
	remarks VARCHAR(32),
	orderTime DATE NOT NULL,
	#   
	PRIMARY KEY (orderNumber),
	#   
	FOREIGN KEY (customerIDCard) REFERENCES customers(customerIDCard),

	FOREIGN KEY (roomNumber) REFERENCES room(roomNumber),

	FOREIGN KEY (waiterID) REFERENCES waiter(waiterID)

) ENGINE=InnoDB;

変更後:
CREATE TABLE orders
(
	#    
	orderNumber CHAR(32) NOT NULL  ,
	#     
	orderStatus CHAR(18) ,
	#      
	customerIDCard CHAR(18),
	#      
	roomNumber CHAR(6) NOT NULL,
	#     
	checkInTime DATE NOT NULL,
	#     
	checkOutTime DATE NOT NULL,
	#     (      ,      )
	totalMoney INT UNSIGNED NOT NULL,
	#      
	waiterID VARCHAR(10) NOT NULL,
	#   
	remarks VARCHAR(32),
	orderTime DATE NOT NULL,
	#   
	PRIMARY KEY (orderNumber),
	#   
	FOREIGN KEY (customerIDCard) REFERENCES customers(customerIDCard),

	FOREIGN KEY (roomNumber) REFERENCES room(roomNumber),

	FOREIGN KEY (waiterID) REFERENCES waiter(waiterID),

	CONSTRAINT orders_ck CHECK (orderStatus in ('   ','   ','   '))

) ENGINE=InnoDB;

6、権限grant文のフォーマットを付与する:
grant権限onデータベース.*toユーザー名@ホストidentified by「パスワード」; 
7、新規ユーザー:
grant select,insert,update,delete on book.* to test2@localhost Identified by "abc"
参考:MySQLユーザーの追加、ユーザーの削除、認可
8、
grant SELECT,INSERT on timeextension to hotel IDENTIFIED by '1234';文のエラー:
ERROR 1064 (42000): 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 'IDENTIFIED by '1234'' at line 1
理由:このバージョンのmysqlバージョンでは、アカウントの作成と付与権限が分離されています.
まずユーザーを作成し、権限を付与します.hotelユーザーを作成した後、権限を付与します(IDENTIFIED by'1234'を削除します):
 grant SELECT,INSERT on timeextension to hotel;
参照:mysqlバージョン:'for the right syntax to use near'identified by'password'with grant option'