Created
April 22, 2022 09:50
-
-
Save thanoojgithub/c2e27e2eedcc32c03d9ac607563806e7 to your computer and use it in GitHub Desktop.
MySQL installation in WSL2 ubuntu
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MySQL installation in ubuntu | |
sudo apt update | |
sudo apt upgrade | |
sudo apt install mysql-server | |
sudo apt install mysql-client | |
mysql --version | |
sudo usermod -d /var/lib/mysql/ mysql | |
sudo service mysql start | |
sudo service mysql status | |
sudo service mysql restart | |
sudo service mysql stop | |
sudo mysql --password | |
mysql> create database mydb; | |
mysql> create user 'thanooj'@'%' identified by 'root'; | |
mysql> grant all on mydb.* to 'thanooj'@'%'; | |
mysql> SHOW GRANTS FOR 'thanooj'@'%'; | |
+---------------------------------------------------+ | |
| Grants for thanooj@% | | |
+---------------------------------------------------+ | |
| GRANT USAGE ON *.* TO `thanooj`@`%` | | |
| GRANT ALL PRIVILEGES ON `mydb`.* TO `thanooj`@`%` | | |
+---------------------------------------------------+ | |
2 rows in set (0.00 sec) | |
thanooj@thanoojWin10Home:~$ sudo mysql -u thanooj -p | |
Enter password: | |
Welcome to the MySQL monitor. Commands end with ; or \g. | |
Your MySQL connection id is 15 | |
Server version: 8.0.28-0ubuntu0.20.04.3 (Ubuntu) | |
Copyright (c) 2000, 2022, Oracle and/or its affiliates. | |
Oracle is a registered trademark of Oracle Corporation and/or its | |
affiliates. Other names may be trademarks of their respective | |
owners. | |
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. | |
mysql> show databases; | |
+--------------------+ | |
| Database | | |
+--------------------+ | |
| information_schema | | |
| mydb | | |
+--------------------+ | |
2 rows in set (0.00 sec) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment