-2

After a fresh new install of MySQL 5.7 on Ubuntu 19, when I attempt to log in for first time I cannot because I don't have the credentials. But the install did not prompt for credentials. I tried doing a grep for 'temporary password' in the following directories but none have a temp password. Where is the default password located? Thank you.

/var/log/mysql/error.log

and

/var/log/syslog
martinb
  • 131
  • 2
  • 11

2 Answers2

2

Restart MySQL in passwordless mode, reset the password, restart the MySQL service.

# 1 : Stop mysql service
/etc/init.d/mysql stop
# 2: Start to MySQL server w/o password:
mysqld_safe --skip-grant-tables &
# Step # 3: Connect to mysql server using mysql client:
mysql -u root
-- 4: Setup new MySQL root user password
use mysql;
update user set password=PASSWORD("NEW-ROOT-PASSWORD") where User='root';
flush privileges;
quit
# 5: Stop MySQL Server:
/etc/init.d/mysql stop
# 6: Start MySQL server and test it
/etc/init.d/mysql start
mysql -u root -p

source

from search

Keith John Hutchison
  • 4,582
  • 8
  • 40
  • 60
1

Can't connect to local MySQL server through socket Follow these step to resolve this

Find your socket file by running.

sudo find / -type s

create a link to this file in tmp directory.

sudo ln -s /var/run/mysqld/mysqld.sock /tmp/mysql.sock