Error while installing mariadb 10.3

while installing mariadb 10.3 i encountered following error

Drop-In: /etc/systemd/system/mariadb.service.d
└─migrated-from-my.cnf-settings.conf
Active: failed (Result: exit-code) since Tue 2019-02-26 13:24:01 IST; 19ms ago
Docs: man:mysqld(8)
systemd - MariaDB Knowledge Base
Process: 16314 ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION (code=exited, status=1/FAILURE)
Process: 16169 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= || VAR=/usr/bin/galera_recovery; [ $? -eq 0 ] && systemctl set-environment _WSREP_START_POSITION=$VAR || exit 1 (code=exited, status=0/SUCCESS)
Process: 16167 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
Process: 16166 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, status=0/SUCCESS)
Main PID: 16314 (code=exited, status=1/FAILURE)
Status: “MariaDB server is down”

Feb 26 13:23:59 avinash-Inspiron-5558 mysqld[16314]: 2019-02-26 13:23:59 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
Feb 26 13:23:59 avinash-Inspiron-5558 mysqld[16314]: 2019-02-26 13:23:59 0 [Note] Plugin ‘FEEDBACK’ is disabled.
Feb 26 13:23:59 avinash-Inspiron-5558 mysqld[16314]: 2019-02-26 13:23:59 0 [Note] InnoDB: Buffer pool(s) load completed at 190226 13:23:59
Feb 26 13:23:59 avinash-Inspiron-5558 mysqld[16314]: 2019-02-26 13:23:59 0 [Note] Server socket created on IP: ‘127.0.0.1’.
Feb 26 13:23:59 avinash-Inspiron-5558 mysqld[16314]: 2019-02-26 13:23:59 0 [ERROR] Can’t start server: Bind on TCP/IP port. Got error: 98: Address already in use
Feb 26 13:23:59 avinash-Inspiron-5558 mysqld[16314]: 2019-02-26 13:23:59 0 [ERROR] Do you already have another mysqld server running on port: 3306 ?
Feb 26 13:23:59 avinash-Inspiron-5558 mysqld[16314]: 2019-02-26 13:23:59 0 [ERROR] Aborting
Feb 26 13:24:01 avinash-Inspiron-5558 systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE
Feb 26 13:24:01 avinash-Inspiron-5558 systemd[1]: mariadb.service: Failed with result ‘exit-code’.
Feb 26 13:24:01 avinash-Inspiron-5558 systemd[1]: Failed to start MariaDB 10.3.13 database server.
dpkg: error processing package mariadb-server-10.3 (–configure):
installed mariadb-server-10.3 package post-installation script subprocess returned error exit status 1
Processing triggers for libc-bin (2.27-3ubuntu1) …
Processing triggers for systemd (237-3ubuntu10.13) …
Processing triggers for ureadahead (0.100.0-20) …
Errors were encountered while processing:
mariadb-server-10.3
E: Sub-process /usr/bin/dpkg returned an error code (1)

It is most likely a permissions problem on the mysql subdir or you need to run

mysql_install_db
to initialize MySQL data directory before starting the process

PS. this isn’t an ERPNext problem, so probably the wrong forum, and most people here are not really mysql/mariadb experts, but hopefully this’ll help you solve it or point you in the right direction.

in run the above mentioned command as sudo mysql_intall_db
then i got this message----

sudo mysql_install_db
Installing MariaDB/MySQL system tables in ‘/var/lib/mysql’ …
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER !
To do so, start the server, then issue the following commands:

‘/usr/bin/mysqladmin’ -u root password ‘new-password’
‘/usr/bin/mysqladmin’ -u root -h avinash-Inspiron-5558 password ‘new-password’

Alternatively you can run:
‘/usr/bin/mysql_secure_installation’

which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.

See the MariaDB Knowledgebase at MariaDB Knowledge Base or the
MySQL manual for more instructions.

You can start the MariaDB daemon with:
cd ‘/usr’ ; /usr/bin/mysqld_safe --datadir=‘/var/lib/mysql’

You can test the MariaDB daemon with mysql-test-run.pl
cd ‘/usr/mysql-test’ ; perl mysql-test-run.pl

Please report any problems at System Dashboard - Jira

The latest information about MariaDB is available at http://mariadb.org/.
You can find additional information about the MySQL part at:
http://dev.mysql.com
Consider joining MariaDB’s strong and vibrant community:
Contribute - MariaDB.org

it was telling me to set the root password for mariadb so i started the services by command-

systemctl status mariadb.service

then i got an error --------

mariadb.service - MariaDB 10.3.13 database server
Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
Drop-In: /etc/systemd/system/mariadb.service.d
└─migrated-from-my.cnf-settings.conf
Active: failed (Result: exit-code) since Tue 2019-02-26 14:19:07 IST; 1min 5s ago
Docs: man:mysqld(8)
systemd - MariaDB Knowledge Base
Main PID: 22523 (code=exited, status=1/FAILURE)
Status: “MariaDB server is down”

Feb 26 14:19:05 avinash-Inspiron-5558 mysqld[22523]: 2019-02-26 14:19:05 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_p
Feb 26 14:19:05 avinash-Inspiron-5558 mysqld[22523]: 2019-02-26 14:19:05 0 [Note] Plugin ‘FEEDBACK’ is disabled.
Feb 26 14:19:05 avinash-Inspiron-5558 mysqld[22523]: 2019-02-26 14:19:05 0 [Note] InnoDB: Buffer pool(s) load completed at 190226 14:19:05
Feb 26 14:19:05 avinash-Inspiron-5558 mysqld[22523]: 2019-02-26 14:19:05 0 [Note] Server socket created on IP: ‘127.0.0.1’.
Feb 26 14:19:05 avinash-Inspiron-5558 mysqld[22523]: 2019-02-26 14:19:05 0 [ERROR] Can’t start server: Bind on TCP/IP port. Got error: 98: Addre
Feb 26 14:19:05 avinash-Inspiron-5558 mysqld[22523]: 2019-02-26 14:19:05 0 [ERROR] Do you already have another mysqld server running on port: 33
Feb 26 14:19:05 avinash-Inspiron-5558 mysqld[22523]: 2019-02-26 14:19:05 0 [ERROR] Aborting
Feb 26 14:19:07 avinash-Inspiron-5558 systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE
Feb 26 14:19:07 avinash-Inspiron-5558 systemd[1]: mariadb.service: Failed with result ‘exit-code’.
Feb 26 14:19:07 avinash-Inspiron-5558 systemd[1]: Failed to start MariaDB 10.3.13 database server.

that means i failed to start the services

First purge the mariadb and follow the steps:

  • sudo apt-get install software-properties-common

  • sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8

  • sudo add-apt-repository ‘deb [arch=amd64,arm64,i386,ppc64el] http://ftp.yz.yamagata-u.ac.jp/pub/dbms/mariadb/repo/10.3/ubuntu xenial main’

  • sudo apt update

  • sudo apt install mariadb-server

  • sudo apt-get install libmysqlclient-dev

I’m not sure why , but it seems you already have a server running…and it is on port 33?? (the default port is 3306). Maybe you need to first stop or restart that one, and then see if it comes up

Did you find a solution??