MySQL 8 Setup on Ubuntu
- Download the deb file https://dev.mysql.com/downloads/repo/apt/
- go to the location where the file was downloaded and run the below command sudo apt-get install ./<file_name>
- run update to get the latest mysql version sudo apt-get update
- install mysql sudo apt-get install mysql-server
- you will be asked to set a root password - set something there.
- select ok for most of the options as the defaults are good.
- you are good to go
Setup Access to root
- you will not be able to access the db using mysql -u root -p with the password you set during installation.
- run sudo mysql_secure_installation to setup the db correctly
- set validate password plugin as false
- set the root password to something you can remember
- set anon uses as false
- set remote access to true / false based on where you want to use it.
- set mysql to be accessed by root with a password
- acess using sudo mysql and run the below commands
- use mysql;
- UPDATE user SET plugin='mysql_native_password' WHERE User='root';
- ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'passw0rd';
- FLUSH PRIVILEGES;
- you should now be able to access the db by calling mysql -u root -p