我正在尝试在创建脚本中使用一些变量来进行数据库设置。我不确定如何使用它们。请解释如何正确格式化我的代码。下面是我尝试的代码,以及我得到的错误:
SET @username = 'xxxx'; -- store number goes here
SET @password = 'xxxxxx'; -- store password goes here
CREATE TABLE IF NOT EXISTS `my_table` (
`id` int(11) auto_increment,
`release_date` datetime,
`front_image_file` varchar(255),
PRIMARY KEY (`id`)
) ENGINE=FEDERATED
DEFAULT CHARSET=latin1
AUTO_INCREMENT=1
CONNECTION='mysql://`@username`:`@password`@host_name:3306/database_name/table_tame' ;
错误
#1432 - Can't create federated table. The data source connection string 'mysql://`@username`:`@password`@host_name:3306/databa' is not in the correct format
我也试过没有`
尝试 EdmundG 的解决方案
SET @username = 'xxxx'; -- store number goes here
SET @password = 'xxxxxx'; -- store password goes here
CREATE TABLE IF NOT EXISTS `my_table` (
`id` int(11) auto_increment,
`release_date` datetime,
`front_image_file` varchar(255),
PRIMARY KEY (`id`)
) ENGINE=FEDERATED
DEFAULT CHARSET=latin1
AUTO_INCREMENT=1
CONNECTION='Uid=@username; Pwd=@password; Server=****; Port=3306; Database =****; Table=****;' ;
没用,还是说格式不正确