etherpad-lite icon indicating copy to clipboard operation
etherpad-lite copied to clipboard

Problem while initalizing the database

Open pucicu opened this issue 15 years ago • 15 comments

I would like to use MySQL instead of SQLite. However, I'm too stupid to get it running.

I did exactly what is provided at https://github.com/Pita/etherpad-lite/wiki/How-to-use-Etherpad-Lite-with-MySQL (but with other login data of course, say, e.g., testadmin as user and testpw as password). I also changed the settings.json file

/* An Example of MySQL Configuration*/ "dbType" : "mysql", "dbSettings" : { "user" : "testadmin", "host" : "localhost", "password": "testpw", "database": "store" },

But I get the message "Problem while initalizing the database" in the log file.

What is wrong? The MySQL port is the standard port (3306). Thanks for any hints.

pucicu avatar Sep 02 '11 21:09 pucicu

Does: mysql -utestadmin -ptestpw store work?

JohnMcLear avatar Sep 02 '11 22:09 JohnMcLear

just a stupid thinking,did you comment out all the following lines:

  "dbType" : "dirty",
  "dbSettings" : {
          "filename" : "../var/dirty.db"
   },

bingjie2680 avatar Sep 03 '11 08:09 bingjie2680

Does: mysql -utestadmin -ptestpw store work?

yes, of course. i have even tested access to the database by writing a simple test php file. i could connect without any problems.

just a stupid thinking,did you comment out all the following lines:

yes, of course. it must be a more serious problem with etherpad-lite as I can connect to the database and test it with another php script.

pucicu avatar Sep 03 '11 20:09 pucicu

Why is this closed if it's not working? *Boggles...

JohnMcLear avatar Sep 03 '11 21:09 JohnMcLear

Hi,

I haven't closed this issue. At least, I don't know how and when I should have done this.

Thus, I'm still fighting with this problem.

pucicu avatar Sep 04 '11 20:09 pucicu

Can it be that you outcomment some settings?

Pita avatar Sep 05 '11 01:09 Pita

ok, here are my settings:

/*
  This file must be valid JSON. But comments are allowed

  Please edit settings.json, not settings.json.template
*/
{
  //Ip and port which etherpad should bind at
  "ip": "0.0.0.0",
  "port" : 9001,

  //The Type of the database. You can choose between sqlite and mysql
  //the database specific settings
  /*"dbType" : "dirty",
  "dbSettings" : {
                   "filename" : "../var/dirty.db"
                 },
  */               
  /* An Example of MySQL Configuration*/
   "dbType" : "mysql",
   "dbSettings" : {
                    "user"    : "testadmin", 
                    "host"    : "localhost", 
                    "password": "testpw", 
                    "database": "store",
                    "port":"3306"
                  },


  //the default text of a pad
  "defaultPadText" : "Welcome to our experimental Etherpad Lite\n\n\n",

  /* if true, all css & js will be minified before sending to the client. This will improve the loading performance massiv
ly, 
     but makes it impossible to debug the javascript/css */
  "minify" : true,

  /* This is the path to the Abiword executable. Setting it to null, disables abiword.
     Abiword is needed to enable the import/export of pads*/  
  "abiword" : "/usr/bin/abiword",
  /*"abiword" : null,*/

  /* The log level we are using, can be: DEBUG, INFO, WARN, ERROR */
  "loglevel": "DEBUG"
}

pucicu avatar Sep 05 '11 08:09 pucicu

just add a console.log(exports.dbSettings); at the end of this file https://github.com/Pita/etherpad-lite/blob/master/node/utils/Settings.js#L100

Pita avatar Sep 05 '11 09:09 Pita

ok, done. here is the log file output:

  host: 'localhost',
  password: 'testpw',
  database: 'store',
  port: '3306' }
[2011-09-05 12:13:22.082] [INFO] console - Your Etherpad Lite git version is 7e4bba0
[2011-09-05 12:13:22.082] [INFO] console - Report bugs at https://github.com/Pita/etherpad-lite/issues
[2011-09-05 12:13:22.088] [ERROR] console - ERROR: Problem while initalizing the database
RESTART!

pucicu avatar Sep 05 '11 10:09 pucicu

if I try to start with bin/run.sh then I get a hint that the problem is in net.js. Is there perhaps something wrong in node.js?

etherpad-lite@tocsy:~> bin/run.sh 
Ensure that all dependencies are up to date...

Ensure jQuery is downloaded and up to date...
Clear minfified cache...
ensure custom css/js files are created...
start...
[2011-09-06 11:53:59.096] [INFO] console - { user: 'testadmin',
  host: 'localhost',
  password: 'testpw',
  database: 'store' }
[2011-09-06 11:53:59.230] [INFO] console - Your Etherpad Lite git version is 7e4bba0
[2011-09-06 11:53:59.230] [INFO] console - Report bugs at https://github.com/Pita/etherpad-lite/issues
[2011-09-06 11:53:59.235] [ERROR] console - ERROR: Problem while initalizing the database
[2011-09-06 11:53:59.236] [ERROR] console - Error: ECONNREFUSED, Connection refused
    at Socket._onConnect (net.js:601:18)
    at IOWatcher.onWritable [as callback] (net.js:186:12)

pucicu avatar Sep 06 '11 09:09 pucicu

What port are you trying to start etherpad lite on?

It looks like something is already using that TCP socket.

Try to telnet the port you are triyng to connect to, see if something else responds.

If not it could be SELinux blocking access to the TCP Port or something..

JohnMcLear avatar Sep 06 '11 10:09 JohnMcLear

I have not changed any ports. Ethetpad lite uses the default port 9001, and this works as far as I run it with sqlite. Mysql is also using default port 3306; others of my websites using mysql are working and I also can connect to the database "store" by using an own test php script.

However, as the server is in the DMZ, alls ports are closed. The only ports open from outside are 80 and 22.

pucicu avatar Sep 06 '11 14:09 pucicu

it looks like there is no mysql listening. Could it be that the mysql command line is using unix sockets? Do a netstat -tulpen on your server please

Pita avatar Sep 14 '11 10:09 Pita

Hi Pita, great! This was the right hint. Mysql wasn't listening. Listening was switched off by default for security reasons. Wouldn't it be possible to use mysql via sockets as the other applications do it? Thank you very much!

pucicu avatar Sep 15 '11 09:09 pucicu

I know this question is a bit dated, but you can use UNIX sockets. I spent about 40 min tracing this all the way back to node-mysql (https://github.com/felixge/node-mysql/issues/60)

Use this line: "port" : "/var/lib/mysql/mysql.sock",

codywilbourn avatar Jan 08 '12 02:01 codywilbourn