RechercheTech / mss

Main MSS feature tracking repo. Also the place for default MSS issues fallinng under no other repo.
1 stars 3 forks source link

Mysql not starting #50

Open intelliant01 opened 6 years ago

intelliant01 commented 6 years ago

Herein is what was tried -

root@server:/home/mssadmin# /etc/init.d/mysql status
● mysql.service - LSB: Start and stop the mysql database server daemon
   Loaded: loaded (/etc/init.d/mysql; bad; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:systemd-sysv-generator(8)

root@server:/home/mssadmin# /etc/init.d/mysql start
[....] Starting mysql (via systemctl): mysql.service
Job for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details.
 failed!

root@server:/home/mssadmin# systemctl status mysql.service
● mysql.service - LSB: Start and stop the mysql database server daemon
   Loaded: loaded (/etc/init.d/mysql; bad; vendor preset: enabled)
   Active: failed (Result: exit-code) since Wed 2017-11-15 13:59:25 IST; 2min 20s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 4233 ExecStart=/etc/init.d/mysql start (code=exited, status=1/FAILURE)

Nov 15 13:59:25 server /etc/init.d/mysql[4717]: 0 processes alive and '/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf ping' resulted in
Nov 15 13:59:25 server /etc/init.d/mysql[4717]: [61B blob data]
Nov 15 13:59:25 server /etc/init.d/mysql[4717]: error: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2 "No such file or directory")'
Nov 15 13:59:25 server /etc/init.d/mysql[4717]: Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists!
Nov 15 13:59:25 server /etc/init.d/mysql[4717]:
Nov 15 13:59:25 server mysql[4233]:    ...fail!
Nov 15 13:59:25 server systemd[1]: mysql.service: Control process exited, code=exited status=1
Nov 15 13:59:25 server systemd[1]: Failed to start LSB: Start and stop the mysql database server daemon.
Nov 15 13:59:25 server systemd[1]: mysql.service: Unit entered failed state.
Nov 15 13:59:25 server systemd[1]: mysql.service: Failed with result 'exit-code'.
intelliant01 commented 6 years ago

Jigish Gohil- moodle's mysql is using default port 98: Address already in use Nov 15 14:05:06 server mysqld: 171115 14:05:06 [ERROR] Do you already have another mysqld server running on port: 3306 ? fix moodle to use another mysql port or use those credentials

intelliant01 commented 6 years ago

Connecting to the moodle inside moodle bitname stack shall require further changes (uninstall / ln / specify socket, etc) to the mysql client as the native mysql client seeks socket at /var/run/mysqld/mysqld.sock .

2 possible approaches to keep it simple -

  1. Remove Mariadb and mysql client completely from MSS native install. Include instructions in the admin guide to manage and use the bitnami stack's mysql. This should be done if Moodle is widely adopted and is established as a necessity with the MSS. We are closing validation in this regards.
  2. Change Mysql port within bitnami moodle stack to 33306. Disadvantage will be having 2 db servers running on the same MSS. Advantage of using the moodle stack mysql will be that it also has phpmyadmin integrated for ease of administration and usage. Yet, have done this for now. Files changed -
    /var/www/html/mss/moodle/mysql/scripts/ctl.sh
    /var/www/html/mss/moodle/mysql/my.cnf
    /var/www/html/mss/moodle/apps/moodle/htdocs/config.php

    Moodle package updated on installer as well.

Use this to access the moodle stack's Mysql through server CLI -

/var/www/html/mss/moodle/mysql/bin/mysql -u root -p 

MySQL admin user is called 'root', and its password is the same as the Moodle administrative user password.

If using the native Mariadb/mysql then the following changes need to be made before students can use it -

  1. Edit /etc/mysql/mariadb.conf.d/50-server.cnf and comment bind-address = 127.0.0.1 to allow users to access the Mysql server from their own machines.

sudo sed -e '/bind-address/ s/^#*/#/' -i /etc/mysql/mariadb.conf.d/50-server.cnf

  1. Setup a user or multiple user(s) with host as '%' via the mysql cli.

Closing this issue for now. Will revisit when required.

intelliant01 commented 4 years ago

For using phpmyadmin from the bitnami stack -

sudo su -

Edit file -

nano /var/www/html/mss/moodle/apps/phpmyadmin/conf/httpd-app.conf

change -

- Require local 
+ Require all granted

Edit file -

nano /var/www/html/mss/moodle/apps/phpmyadmin/htdocs/config.inc.php

change -

- $cfg['Servers'][$i]['port'] = '3306';
+ $cfg['Servers'][$i]['port'] = '33306';

In /var/www/html/mss/moodle/mysql/my.cnf

change -

- bind-address = 127.0.0.1
+ #bind-address = 127.0.0.1

Restart all MySQL and Apache -

/var/www/html/mss/moodle/ctlscript.sh restart

phpMyadmin accessible via - http://{server|<serverip>}:81/phpmyadmin

Credentials - root / myskool

Console access - mysql -u <username> -P 33306 -h {server|<serverip>} -p

For e.g. mysql -u root -P 33306 -h server -p

intelliant01 commented 3 years ago

Have made access to phpmyadmin of the bitnami stack a standard feature.

Now phpmyadmin is accessible from any other system on the local network via http://{server|<serverip>}:81/phpmyadmin.

However default console root access is restricted to remmina session into server i.e. Administration or Admin Desktop (old MSS), using -h server.

Documented in FAQs - https://helpdesk.myscoolserver.com/portal/en/kb/articles/steps-to-use-the-mysql-database-on-the-mss

Pending in manual.

intelliant01 commented 3 years ago

All working from Pi client after adding mysql-client packages.