How to setup, install, and start MySQL on Ubuntu
Step-1: Open a terminal and execute the following commands
kodingwindow@kw:~$ sudo apt-get install mysql-server [sudo] password for kodingwindow: Reading package lists... Done Building dependency tree Reading state information... Done The following additional packages will be installed: ... After this operation, 246 MB of additional disk space will be used. Do you want to continue? [Y/n] y
Step-2: Check MySQL server status
kodingwindow@kw:~$ systemctl status mysql ● mysql.service - MySQL Community Server Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset:> Active: active (running) since Fri 2024-03-01 09:49:13 IST; 30min ago Main PID: 723 (mysqld) Status: "Server is operational" Tasks: 38 (limit: 9171) Memory: 424.0M CPU: 12.957s CGroup: /system.slice/mysql.service └─723 /usr/sbin/mysqld Mar 01 09:49:12 kw systemd[1]: Starting MySQL Community Server... Mar 01 09:49:13 kw systemd[1]: Started MySQL Community Server.
Step-3: Start MySQL
kodingwindow@kw:~$ sudo mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 10 Server version: 8.0.36-0ubuntu0.22.04.1 (Ubuntu) Copyright (c) 2000, 2024, 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 | | mysql | | performance_schema | | sys | +--------------------+ 4 rows in set (0.02 sec) mysql>
Recommendations
MySQL CREATE a DATABASE and TABLE
Java MySQL to connect, create database, and table
Python MySQL to connect, create database, and table
Advertisement