28 lines
801 B
JavaScript
28 lines
801 B
JavaScript
import mysql from 'mysql2/promise';
|
|
|
|
async function main() {
|
|
console.log('Connecting to MySQL at 103.155.224.244...');
|
|
try {
|
|
const connection = await mysql.createConnection({
|
|
host: '103.155.224.244',
|
|
user: 'root',
|
|
password: 'hqn9OY2pJx1oYRYJoVrC0Q64sZj8k3W3ZpoVcsKAmv1DFqO9u0DIMGCkjjXEjLaB',
|
|
connectTimeout: 10000,
|
|
});
|
|
|
|
console.log('Connected successfully!');
|
|
const [rows] = await connection.query('SHOW DATABASES;');
|
|
console.log('Databases:', rows);
|
|
|
|
// Create database if not exists
|
|
await connection.query('CREATE DATABASE IF NOT EXISTS aghatis_studio_db;');
|
|
console.log('Database aghatis_studio_db checked/created.');
|
|
|
|
await connection.end();
|
|
} catch (err) {
|
|
console.error('Connection failed:', err.message);
|
|
}
|
|
}
|
|
|
|
main();
|