Thanks to Wojtek Dmyszewicz on StackOverflow for saving me time and frustration when I ran into [ERROR] InnoDB: Unable to lock ./ibdata1, error
while working with MariaDB at the command line.
The solution is to list all currently running MariaDB processes, which call themselves ‘mysql’ for compatibility with MySQL:
ps aux | grep mysql
This will output some results, such as this:
luke@hostname:~$ ps aux | grep mysql
mysql 1681 0.1 17.7 684476 88716 ? Ssl 10:07 0:04 /usr/sbin/mysqld
luke 5294 0.0 0.1 14232 944 pts/0 S+ 10:50 0:00 grep --color=auto mysql
luke@hostname:~$
This shows you the process ID for your running mysql processes, which you can then kill. In this case I would execute:
sudo kill 1681