How to install mysql on ubuntu 16.04

මුල් ලිපි වලින් කිව්වා java install කරලා tomcat run කරන විදිහ. දැන් බලමු  mysql install කරන විදිහ.

java install කරන විදිහ (කලින් ලිපිය මෙතනින්  බලන්න ) 

tomcat run කරන විදිහ (කලින් ලිපිය මෙතනින්  බලන්න )

මුලින්ම update කරන්න.

sudo apt update

mysql install කරන්න

sudo apt install mysql-server

දැන් root password දෙන්න

password එක re-enter කරන්න.(කලින් කිව්වා වගේ  common password නම් දෙන්නම එපා)

දැන් security script එක run කරලා configure කරන්න. මේකෙන් default secure options වෙනස් කරන්න පුළුවන් (like remote root logins and sample users)

mysql_secure_installation

මෙහෙම list එකක් එයි, එක ඔයාට කැමති විදිහට Y  or  N යොදල වෙනස්කරගන්න පුළුවන්.

Securing the MySQL server deployment.

Enter password for user root: 

VALIDATE 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: **********
Using existing password for root.

Estimated strength of the password: 50 
Change the password for root ? ((Press y|Y for Yes, any other key for No) : Y

New password: 

Re-enter new password: 

Estimated strength of the password: 100 
Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y
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) : Y
- Dropping test database...
Success.

- Removing privileges on test database...
Success.

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!

ඊළගට Testing කරලා බලන්න එකට,

service mysql status

හෝ

systemctl status mysql.service

Active: active (running) කියල පෙන්නුවේ නැත්තම් sudo systemctl start mysql කියල type කරලා enter කරන්න.

version එක හා  අනිත් විස්තර බලාගන්න.

mysqladmin -p -u root version
Output
mysqladmin  Ver 8.42 Distrib 5.7.22, for Linux on x86_64 
Copyright (c) 2000, 2018, 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.22-0ubuntu0.16.04.1 
Protocol version        10 
Connection              Localhost via UNIX socket 
UNIX socket             /var/run/mysqld/mysqld.sock 
Uptime:                 1 hour 2 min 9 sec 

Threads: 1  Questions: 23  Slow queries: 0  Opens: 117  Flush tables: 1  Open tables: 36  Queries per second avg: 0.006

මෙහෙම output එකක් අව කියන්නේ වැඩේ හරි. mysql install කරලා ඉවරයි.?

You May Also Like

About the Author: VJRanga