Skip to main content
Skip table of contents

Ubuntu 16.04 Instance Üzerinde MySQL Kurulumu

MySQL açık kaynaklı veritabanı yönetimi sistemidir. İlişkisel bir veritabanıdır ve verileri yönetirken SQL sorgulama dilini kullanır.

MySQL'i indirmeden önce sistemimizin güncel olduğundan emin olmamız gerekiyor. Bunun için

CODE
$ sudo apt update & sudo apt upgrade

Sistemimizi güncelledikten sonra mysql-server paketlerini indirmemiz gerekiyor.

CODE
$ sudo apt install mysql-server

İndirme süresince karşınıza mysql root kullanıcı için şifre oluşturma ekranı çıkacaktır. Bu ekrandan bir şifre oluşturmanız gerekmektedir. Yükleme işlemi bittikten sonra MySQL'i daha güvenli hale getirmek için güvenlik betiğini başlatmamız gerekiyor.

CODE
$ mysql_secure_installation

Betik çalıştıktan sonra size root şifresini soracaktır. Yükleme sırasında belirlediğiniz root şifresini girmeniz gerekmektedir. Çıkan ekranları aşağıdaki gibi yapabilirsiniz. Daha güçlü şifreler için password validation policy kısmını 2 yapabilirsiniz. Ayrıca kurulum sırasında belirlediğiniz root şifresini değiştirmek istiyorsanız Change the password for root ? kısmın y yapıp yeni bir şifre belirleyebilirsiniz.

CODE
Securing the MySQL server deployment.
Enter password for user root:
ALIDATE PASSWORD PLUGIN can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD plugin?
Press y|Y for Yes, any other key for No: y
There are three levels of password validation policy:
LOW Length >= 8
MEDIUM Length >= 8, numeric, mixed case, and special characters
STRONG Length >= 8, numeric, mixed case, special characters and dictionary file
Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 1
Using existing password for root.
Estimated strength of the password: 25 
Change the password for root ? ((Press y|Y for Yes, any other key for No) : n
... skipping.
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
environment.

Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
Success.

Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network.
Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y
Success.

By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment.

Remove test database and access to it? (Press y|Y for Yes, any other key for No) : n
... skipping.
Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.
Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
Success.
All done!  

Bu işlemlerden sonra mysql servisinin durumunu kontrol etmeyliz.

CODE
$ sudo service mysql status
● mysql.service - MySQL Community Server
 Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
 Active: active (running) since Mon 2017-12-11 15:04:12 UTC; 11min ago
 Main PID: 13748 (mysqld)
 CGroup: /system.slice/mysql.service
 └─13748 /usr/sbin/mysqld

Çıktısında görüldüğü gibi mysql servisi aktif ve çalışıyor. Mysql i kontrol etmek için ayrıca

CODE
$ mysqladmin -u root -p version 

komutunuda kullanabilir. Çıkan ekranda root şifremizi girdirden sonra karşımıza aşağıdaki gibi bir ekran çıkmalıdır.

CODE
Enter password: 
mysqladmin Ver 8.42 Distrib 5.7.20, for Linux on x86_64
Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Server version 5.7.20-0ubuntu0.16.04.1
Protocol version 10
Connection Localhost via UNIX socket
UNIX socket /var/run/mysqld/mysqld.sock
Uptime: 12 min 50 sec
Threads: 1 Questions: 124 Slow queries: 0 Opens: 206 Flush tables: 1 Open tables: 64 Q

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.