I just installed mysql-server in ubuntu and when I want to enter it asks me for a password, which in the installation did not ask me for any password. I need help with this I've been searching and doing things for more than 1 day and nothing works. I thank you all.
Versions: 1 Ubuntu 18.04 LTS 2 mysql Ver 14.14 Distrib 5.7.22, for Linux (x86_64) using EditLine wrapper
Well I was able to solve this, if someone later gets the same error here is the solution: 1. Uninstall all mysql from my system with the following command:
Well now a little explanation for what we did.
— purge : We remove the packages and configuration files. remove : uninstall packages. autoremove : Force to remove packages that were automatically installed due to the needs of dependencies on other packages and are now no longer needed.
Then I install mysql again but with these commands:
I found the necessary steps to follow on this page: install mysql with users and passwords
I have followed the procedure as is and I have been able to reset the administrator password.
1º You create the sql file with the command to change the password ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass';
2nd Stop mysql kill
cat /mysql-data-directory/host_name.pid
3º You start mysql with the sql file that you created at startup. mysqld --init-file=/home/me/mysql-init &
Although it really worked out for me to start mysql with the --skip-grant-tables parameter. At that moment, it no longer asks for the password when entering, you change the root password, stop it and start without the parameter.
https://dev.mysql.com/doc/refman/8.0/en/resetting-permissions.html
Well, the same thing happened to me, you have to know that there is only one way to access the root user and that is to first change as a super user, then access the database and finally create another user to be able to enter directly. Or just always use from step 1 to 3 to work with the database every time you want to use it
Switch as root
sudo -i
Enter the database
mysql -u root -p
You will be in the DB as root, here you can already use the databases
Create a new user
create user username identified by 'password' -->**(structure)
create user root1 identified by 'password' -->example (example)
Login with this created user, but every time you want to enter the database, you will have to switch to root first with "sudo -i" and then login to the database.
Test if the new profile works
mysql -u root1 -p
Enter password, hit enter and you should be able to see the base with the new user.
More information: https://www.youtube.com/watch?v=Pdn-tAFyGjo