You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
help: 'Ensure that MySQL is installed and reachable. You can always re-run `ghost setup` to try again.'
62
-
}));
90
+
});
63
91
}elseif(error.code==='ER_ACCESS_DENIED_ERROR'){
64
-
returnPromise.reject(newConfigError({
92
+
thrownewConfigError({
65
93
message: error.message,
66
94
config: {
67
95
'database.connection.user': dbconfig.user,
68
96
'database.connection.password': dbconfig.password
69
97
},
70
98
environment: this.system.environment,
71
99
help: 'You can run `ghost config` to re-enter the correct credentials. Alternatively you can run `ghost setup` again.'
72
-
}));
100
+
});
73
101
}
74
102
75
-
returnPromise.reject(newCliError({
103
+
thrownewCliError({
76
104
message: 'Error trying to connect to the MySQL database.',
77
105
help: 'You can run `ghost config` to re-enter the correct credentials. Alternatively you can run `ghost setup` again.',
78
106
err: error
79
-
}));
80
-
});
107
+
});
108
+
}
109
+
110
+
constversion=awaitthis.getServerVersion();
111
+
if(version){
112
+
if(isUnsupportedMySQL(version)){
113
+
thrownewSystemError({
114
+
message: `Error: unsupported MySQL version (${version.raw})`,
115
+
help: 'Update your MySQL server to at least MySQL v5.7 in order to run Ghost'
116
+
});
117
+
}
118
+
119
+
ctx.mysql={version};
120
+
}
81
121
}
82
122
83
-
createUser(ctx,dbconfig){
123
+
randomUsername(){
124
+
// IMPORTANT: we generate random MySQL usernames
125
+
// e.g. you delete all your Ghost instances from your droplet and start from scratch, the MySQL users would remain and the CLI has to generate a random user name to work
126
+
// e.g. if we would rely on the instance name, the instance naming only auto increments if there are existing instances
127
+
// the most important fact is, that if a MySQL user exists, we have no access to the password, which we need to autofill the Ghost config
128
+
// disadvantage: the CLI could potentially create lot's of MySQL users (but this should only happen if the user installs Ghost over and over again with root credentials)
returnthis._query(`SELECT PASSWORD('${randomPassword}') AS password;`);
103
-
}).then((result)=>{
104
-
this.ui.logVerbose('MySQL: successfully created password hash.','green');
105
-
106
-
consttryCreateUser=()=>{
107
-
// IMPORTANT: we generate random MySQL usernames
108
-
// e.g. you delete all your Ghost instances from your droplet and start from scratch, the MySQL users would remain and the CLI has to generate a random user name to work
109
-
// e.g. if we would rely on the instance name, the instance naming only auto increments if there are existing instances
110
-
// the most important fact is, that if a MySQL user exists, we have no access to the password, which we need to autofill the Ghost config
111
-
// disadvantage: the CLI could potentially create lot's of MySQL users (but this should only happen if the user installs Ghost over and over again with root credentials)
0 commit comments