Closed iwantlogic closed 8 months ago
You normally not required to run mysql_install_db
. But if you decide to do so, make sure you use correct options.
Bare minimum:
mysql_install_db --user=root --auth-root-authentication-method=normal --datadir=${PREFIX}/var/lib/mysql --basedir=${PREFIX}
Ensure that var/lib/mysql is empty before running this command.
Don't specify -p
while running mysql
client if never configured root password.
You normally not required to run
mysql_install_db
. But if you decide to do so, make sure you use correct options.Bare minimum:
mysql_install_db --user=root --auth-root-authentication-method=normal --datadir=${PREFIX}/var/lib/mysql --basedir=${PREFIX}
Ensure that var/lib/mysql is empty before running this command.
Don't specify
-p
while runningmysql
client if never configured root password.
Same error Edit: Saw that the mysql daemon was still running even when i exited
You are not explaining all steps you did.
Read my previous message.
You may not run mysql_install_db
unless manually erased $PREFIX/var/lib/mysql
. The latter mentioned directory must be empty before you start initializing the new database.
When using mysql_install_db
you should pay attention to used flags. Don't use defaults. They will never work for Termux.
To reinitialize the database directory, run these two commands:
rm -rf $PREFIX/var/lib/mysql
mysql_install_db --user=root --auth-root-authentication-method=normal --datadir=${PREFIX}/var/lib/mysql --basedir=${PREFIX}
The flag --auth-root-authentication-method=normal
is important. Without it authentication will become broken.
To connect as root, use mysql -u root
. Don't specify password requesting flag -p
, there is no password set by default. Use flag -p
only after setting user password.
Everything above is not just recommendations. This is only way how you can set up mariadb in Termux.
This works for me
killall mariadbd
rm -rf $PREFIX/var/lib/mysql/*
mysql_install_db --user=root --auth-root-authentication-method=normal --datadir=${PREFIX}/var/lib/mysql
mysqld_safe -u root &
Change password
mysql -u root
use mysql;
set password for 'root'@'localhost' = password('YOUR_ROOT_PASSWORD_HERE');
flush privileges;
quit;
Allow remote access
CREATE USER 'root'@'%' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;
Problem description
So i installed the db and started the daemon normally
And then i logged in as
$(whoami)
I did show databases and then there is no mysql!
And i tried logging in as root and this happened
What steps will reproduce the bug?
install mariadb Start the daemon Login as root in mysql
What is the expected behavior?
It'll login as root and show mysql
System information
termux-info: