MySQL Ubuntu How to Install, Reinstall and Uninstall MySQL

GOLO

Administrator
Администратор
Premium
Регистрация
31.07.2017
Сообщения
61
Реакции
24
Баллы
8
Страна
Sweden
Native language | Родной язык
Русский

Install MySQL default package​


Update your package version in order to install latest possible version. Then install MySQL server by installing the default package. Optionally you can install additional libraries for MySQL like workbench. The last command is needed if you want to configure your server security. This script will delete test data, password levels will be set up and root account password will be changed:

Код:
sudo apt-get update
sudo apt-get install mysql-server

sudo apt-get install mysql-client
sudo apt-get install mysql-workbench

sudo mysql_secure_installation

Testing MySQL​


After the successful installation MySQL should start automatically. You can test it by:
Код:
systemctl status mysql.service

You'll see output similar to the following:


Output:
Код:
mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: en
  Active: active (running) since Wed 2016-11-23 21:21:25 UTC; 30min ago
Main PID: 3754 (mysqld)

If you are able to see it then this means MySQL is up and running.


Connect to MySQL​


Connection to MySQL with user root and password with(you will be prompted for the password) : mysql -u [username]-p
Код:
mysql -u root -p

reinstall MySQL server​


Код:
sudo apt-get remove --purge mysql-server mysql-client mysql-common
sudo apt-get autoremove
sudo apt-get autoclean
 
198 096Темы
635 067Сообщения
3 618 395Пользователи
ashot.Новый пользователь
Верх