Close Menu
  • Home
  • Java
  • JavaScript
  • Hibernate
  • Deployment
  • Spring
Facebook X (Twitter) Instagram
Developers GroundDevelopers Ground
Facebook X (Twitter) Instagram
  • Home
  • Java
  • JavaScript
  • Hibernate
  • Deployment
  • Spring
Developers GroundDevelopers Ground
Home How to Setup MySQL on Ubuntu Server
Deployment

How to Setup MySQL on Ubuntu Server

Omkar PanditBy Omkar PanditMarch 13, 2023Updated:August 17, 2023No Comments1 Min Read
Facebook Twitter Pinterest LinkedIn Tumblr Reddit WhatsApp Email
Share
Facebook Twitter LinkedIn Pinterest WhatsApp Email
sudo apt update
sudo apt upgrade
Update Package Repository & Install MySQL
sudo apt update 
sudo apt upgrade
Enter: Y
sudo apt install mysql-server
Enter: Y
mysql –version 
sudo mysql_secure_installation
  • To remove anonymous users, enter Y and press enter.
  • To prevent remote root login, enter Y and press enter.
  • To remove the test database, enter Y and press enter.
  • To reload the privilege tables, enter Y and press enter.
sudo mysql
mysql> CREATE USER 'username'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
mysql> GRANT ALL PRIVILEGES ON *.* TO 'username'@'localhost';
mysql> FLUSH PRIVILEGES;
mysql> ALTER USER 'username'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
systemctl status mysql.service
sudo service mysql restart
sudo mysql --user=root -p[ROOT_PASSWORD] -e "show databases"
Login with MySQL User
sudo mysql -u root -p
Check 3306 Port Active or Not
sudo lsof -i -P -n | grep LISTEN
To see MySQL User List:
SELECT user,authentication_string,plugin,host FROM mysql.user;
Change in MySQL config file to allow remote access to MySQL DB Change in below => bind-address= 127.0.0.1 to bind-address= 0.0.0.0
sudo cat /etc/mysql/mysql.conf.d/mysqld.cnf 
sudo service mysql restart
Total
0
Shares
Share 0
Tweet 0
Pin it 0
Share 0
Omkar Pandit

Related Posts

Java Objects

January 11, 2024

Installing node.js Setup in AWS EC2 instance (Linux)

March 13, 2023
Leave A Reply Cancel Reply

Featured Posts
  • 1
    Understanding the Java String Class
    • April 10, 2025
  • 2
    Array in Java
    • February 19, 2024
  • 3
    Control Statements
    • January 16, 2024
  • 4
    Java Objects
    • January 11, 2024
  • 5
    Java Constructors
    • January 2, 2024
Facebook X (Twitter) Instagram Pinterest
© 2025 Developers Ground, All rights reserved.

Type above and press Enter to search. Press Esc to cancel.