I am installing mysql on my Onion Omega2+ IoT board. The command 'opkg update && opkg install mariadb-client mariadb-server' installs mysql, then I run the command mysql through shell, following error occurs: 'mysqld: datadir '/mnt/data/mysql/' in '/etc/mysql/my.cnf' does not exist'. there is no directory like /mnt/data/mysql/ and I changed it. Then I ran command mysql through the terminal, it gives error: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2 "No such file or directory"). I checked directory /var/run/mysqld/mysqld.sock does not exist, so I created it as well following error: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)' -- Missing /var/run/mysqld/mysqld.sock I checked /etc/mysql/my.conf file and rerun 'mysql', finally this error ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (146 "Lock timed out; Retry transaction") I found this error only on the mysql errors page, couldn't find the reason, please help (maybe useful: /var directory is actually a link to /tmp and there is another socket file /var/run/ubus.sock, so I tried creating socket file in that directory as well, same result)
my my.cnf file looks like:
[client]
port = 3306
socket = /var/run/mysqld/mysqld.sock
[mysqld]
user = mariadb
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
############ Don't put this on the NAND #############
# Figure out where you are going to put the databases
# And run mysql_install_db --force
datadir = /mnt/mmcblk0p1/mysql
######### This should also not go on the NAND #######
tmpdir = /mnt/mmcblk0p1/mysql
skip-external-locking
bind-address = 127.0.0.1
# Fine Tuning
key_buffer_size = 16M
max_allowed_packet = 16M
thread_stack = 192K
thread_cache_size = 8
# Here you can see queries with especially long duration
#log_slow_queries = /var/log/mysql/mysql-slow.log
#long_query_time = 2
#log-queries-not-using-indexes
# The following can be used as easy to replay backup logs or for replication.
#server-id = 1
#log_bin = /var/log/mysql/mysql-bin.log
#expire_logs_days = 10
#max_binlog_size = 100M
#binlog_do_db = include_database_name
#binlog_ignore_db = include_database_name
[mysqldump]
quick
quote-names
max_allowed_packet = 16M
[mysql]
#no-auto-rehash # faster start of mysql but no tab completition
[isamchk]
key_buffer = 16M