Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

没有sql文件.执行./init, ./yii migrate 报错. #4

Open
GordonHuangYong opened this issue May 15, 2018 · 3 comments
Open

没有sql文件.执行./init, ./yii migrate 报错. #4

GordonHuangYong opened this issue May 15, 2018 · 3 comments

Comments

@GordonHuangYong
Copy link

image
执行./init报错.
image
./yii migrate
又报错

整个项目也没有发现sql文件.无法正常运行.

@osakey
Copy link

osakey commented May 26, 2018

看错误你数据库 配置有问题。 把 localhost 改成 127.0.0.1吧

@kingwon
Copy link

kingwon commented Sep 25, 2018

m130524_201442_init 里面如果设置数据库为$tableOptions = 'CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci ENGINE=InnoDB';
会报下面的错误;

Apply the above migrations? (yes|no) [no]:yes
*** applying m130524_201442_init
> create table {{%user}} ...Exception 'yii\db\Exception' with message 'SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes
The SQL being executed was: CREATE TABLE user (
id int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
username varchar(255) NOT NULL UNIQUE,
auth_key varchar(32) NOT NULL,
password_hash varchar(255) NOT NULL,
password_reset_token varchar(255) UNIQUE,
email varchar(255) NOT NULL UNIQUE,
status smallint(6) NOT NULL DEFAULT 10,
created_at int(11) NOT NULL,
updated_at int(11) NOT NULL
) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci ENGINE=InnoDB'

in E:\Code\richin-cms\vendor\yiisoft\yii2\db\Schema.php:664

Error Info:
Array
(
[0] => 42000
[1] => 1071
[2] => Specified key was too long; max key length is 767 bytes
)

@secretgao
Copy link

mysql 版本问题 用5.7+ 就没事了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants