Jalankan perintah berikut untuk memperbarui indeks paket lokal dengan perubahan terbaru yang dibuat di repositori
sudo apt update
Langkah 2. Tingkatkan paket
Ketik perintah berikut untuk mengupgrade sistem
sudo apt upgrade
_
Langkah 3. Konfigurasikan MySQLPPA
MySQL menyediakan repositori APT untuk menginstal server dan alat MySQL. Anda perlu menambahkan repositori MySQL ini ke daftar sumber paket sistem Anda
Pertama, unduh paket repositori menggunakan perintah ________1______3
wget -c https://repo.mysql.com//mysql-apt-config_0.8.13-1_all.deb
Code language: JavaScript (javascript)
Kemudian, instal paket repositori MySQL menggunakan perintah
sudo apt upgrade
4 berikut
sudo dpkg -i mysql-apt-config_0.8.13-1_all.deb
Code language: CSS (css)
Langkah 4. Instal MySQL
Jalankan perintah berikut untuk mulai menginstal MySQL
sudo apt-get install mysql-server
Code language: JavaScript (javascript)
_
Ini akan menanyakan kata sandi
sudo apt upgrade
_5. Masukkan kata sandi yang aman dan lanjutkan
Langkah 5. Instalasi server MySQL yang aman
Jalankan perintah berikut untuk menyesuaikan keamanan ke Server MySQL
sudo mysql_secure_installation
_
Ini akan meminta Anda beberapa opsi keamanan yang harus Anda pilih untuk mengamankan server MySQL
- Hapus pengguna anonim? . Y untuk Ya, kunci lain untuk Tidak). y
- Larang login root dari jarak jauh? . Y untuk Ya, kunci lain untuk Tidak). y
- Hapus basis data pengujian dan akses ke sana? . Y untuk Ya, kunci lain untuk Tidak). y
- Muat ulang tabel hak istimewa sekarang? . Y untuk Ya, kunci lain untuk Tidak). y
Langkah 6. Kelola Server MySQL melalui Systemd
Biasanya, layanan MySQL dimulai secara otomatis setelah paket dikonfigurasi. Untuk memeriksa apakah server MySQL aktif dan berjalan atau tidak, Anda menggunakan perintah ini
sudo systemctl status mysql
_
Jika Anda menemukan bahwa server MySQL tidak mulai secara otomatis, Anda dapat menggunakan perintah berikut untuk memulainya
sudo systemctl status mysql
_
Dan mulai secara otomatis saat startup sistem
sudo systemctl enable mysql
Langkah 7. Hubungkan ke server MySQL
Untuk terhubung ke Server MySQL, gunakan perintah ini
sudo mysql -u root -p
Ini akan meminta kata sandi dari akun root. Anda memasukkan kata sandi dan menekan
sudo apt upgrade
_6, perintah berikut akan menunjukkan apakah kata sandi itu valid
Pengguna Ubuntu memiliki pilihan antara dua Relational Database Management Systems (RDBMS) yang andal, MySQL dan MariaDB. MySQL memiliki popularitas yang sudah lama ada, tetapi ada peningkatan minat pada MariaDB karena keunggulan kinerjanya dan fitur tambahan. Panduan ini membandingkan dua sistem database dan memberikan instruksi tentang cara menginstal dan menggunakan MySQL di Ubuntu 20. 04
Apa itu MySQL?
MySQL RDBMS adalah salah satu aplikasi open source paling populer. Ini adalah bagian dari LAMP Stack, yang merupakan landasan dari banyak sistem Ubuntu. Tumpukan ini terdiri dari Linux, server web Apache, RDBMS MySQL, dan bahasa pemrograman PHP. Aplikasi ini bekerja sama untuk mendukung aplikasi web, pengembangan perangkat lunak, dan aktivitas khusus seperti ilmu data. Penggunaan utama MySQL adalah dalam konfigurasi server tunggal berukuran kecil hingga menengah
Kueri MySQL ditulis dalam Structured Query Language (SQL). Sebagai database relasional, ia menyimpan dan mengatur data dalam tabel. Tabel menyusun data aktual di dalam tabel sebagai rangkaian baris, dengan setiap baris terdiri dari satu atau lebih kolom. Setiap baris mewakili entri yang berbeda dalam tabel, sementara setiap kolom berisi satu bidang data di dalam entri tersebut. Bidang data dalam tabel ini dapat dihubungkan satu sama lain, dan hubungan ini membantu menyusun dan mengatur database. Pernyataan SQL khusus mengizinkan klien untuk menambah, menghapus, memodifikasi, dan mengambil data
MySQL dikenal dengan stabilitas dan keandalannya serta dianggap sederhana dan mudah digunakan. Ini tersedia sebagai perangkat lunak sumber terbuka gratis di bawah Lisensi Publik Umum GNU. MySQL sudah tersedia untuk semua distribusi Linux serta sistem operasi lainnya. Sekarang dimiliki oleh Oracle Corporation. Oracle juga menawarkan MySQL Enterprise Edition komersial sebagai produk kelas atas
MySQL vs. MariaDB
Dua alternatif database open source utama, MySQL dan MariaDB, sangat mirip. Keduanya adalah produk RDBMS dan keduanya menggunakan SQL. Kedua sistem basis data memiliki versi gratis, dan mereka terlihat dan bertindak dengan cara yang hampir sama. Karena MariaDB awalnya bercabang dari MySQL, hal ini tidak mengherankan. MariaDB sejak itu mengalami pengembangan lebih lanjut dan menghadirkan banyak peningkatan baru dalam keamanan dan kinerja. Namun, dengan MySQL, banyak fitur lanjutan yang hanya ditemukan di Edisi Perusahaan. Berikut ringkasan persamaan dan perbedaan antara kedua produk tersebut
- MariaDB mendukung lebih banyak koneksi daripada MySQL
- Kedua database dapat bekerja dengan banyak sistem penyimpanan, meskipun MariaDB menawarkan lebih banyak opsi
- MariaDB dapat mereplikasi data lebih cepat daripada MySQL dan memiliki kinerja keseluruhan yang lebih baik. MySQL menangani transaksi besar secara lebih efektif, tetapi kinerja MariaDB lebih baik dalam situasi berskala
- MySQL mendukung beberapa fitur yang tidak dimiliki MariaDB, seperti kolom dinamis. Setiap database memiliki beberapa fitur dan peningkatan lanjutan yang tidak dimiliki database lainnya
- MySQL lebih tua, lebih mapan, lebih populer, dan memiliki lebih banyak dukungan komunitas. MySQL menawarkan paket dukungan berbayar yang lebih komprehensif
- MariaDB dan MySQL sepenuhnya kompatibel
- Kedua produk tersebut adalah open source, tetapi model lisensi MySQL lebih ketat
Singkatnya, kedua sistem lebih dari cukup untuk sebagian besar pengguna. MariaDB menampilkan kinerja yang lebih baik, sedangkan MySQL lebih mapan dan didukung lebih baik
Sebelum kamu memulai
Catatan
Langkah-langkah dalam panduan ini ditulis untuk pengguna non-root. Perintah yang membutuhkan hak tinggi diawali dengan
VALIDATE PASSWORD COMPONENT 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 component?
8. Jika Anda tidak terbiasa dengan perintah
VALIDATE PASSWORD COMPONENT 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 component?
_8, lihat panduan Pengguna dan Grup Linux
Cara Instal Server MySQL
MySQL tersedia sebagai bagian dari paket default Ubuntu, jadi tidak perlu mengedit daftar sumber. Itu dapat dengan mudah diinstal menggunakan
Please set the password for root here.
New password:
Re-enter new password:
_0, tetapi penting untuk mengamankan aplikasi dan mengedit firewall sesudahnya. Petunjuk ini ditujukan untuk pengguna Ubuntu, tetapi secara umum berlaku bagi mereka yang ingin menginstal MySQL di distribusi Linux lainnya
Unduh MySQL
Untuk menginstal server MySQL di Ubuntu, ikuti langkah-langkah di bawah ini
Instal aplikasi server MySQL
sudo apt install mysql-server
Konfirmasikan server MySQL berjalan menggunakan perintah
Please set the password for root here.
New password:
Re-enter new password:
1. Itu harus menampilkan status Please set the password for root here.
New password:
Re-enter new password:
2sudo systemctl status mysql
mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset:>
Active: active (running) since Thu 2021-09-09 12:24:29 UTC; 1h 44min ago
Konfigurasi Server MySQL di Linux
Utilitas
Please set the password for root here.
New password:
Re-enter new password:
_3 adalah cara termudah untuk mengonfigurasi aplikasi. Untuk menggunakan skrip penyiapan, ikuti langkah-langkah berikut
Luncurkan utilitas
Please set the password for root here.
New password:
Re-enter new password:
_3 untuk mengatur kata sandi root dan mengonfigurasi opsi default lainnyasudo mysql_secure_installation
Aplikasi menanyakan apakah akan mengaktifkan komponen
Please set the password for root here.
New password:
Re-enter new password:
5. Jika Anda menjawab Please set the password for root here.
New password:
Re-enter new password:
_6, ia akan menanyakan apakah akan mengatur kekuatan kata sandi ke Please set the password for root here.
New password:
Re-enter new password:
7, Please set the password for root here.
New password:
Re-enter new password:
8, atau Please set the password for root here.
New password:
Re-enter new password:
9VALIDATE PASSWORD COMPONENT 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 component?
Pada prompt berikutnya, utilitas meminta kata sandi untuk akun root. Tetapkan kata sandi lalu masukkan kembali
Please set the password for root here.
New password:
Re-enter new password:
Pertanyaan berikut menanyakan apakah akan menghapus pengguna anonim, mengizinkan akun
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) :
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) :
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
0 terhubung dari jarak jauh, dan menghapus database 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) :
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) :
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
1. Masukkan Please set the password for root here.
New password:
Re-enter new password:
6 atau 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) :
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) :
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
3 di setiap prompt sesuai dengan preferensi Anda. Basis data 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) :
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) :
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
_1 berguna selama validasi awal, tetapi untuk alasan keamanan, yang terbaik adalah melarang akun 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) :
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) :
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
0 masuk dari jarak jauhBy 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) :
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) :
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
Saat diminta, muat ulang tabel
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) :
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) :
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
_6 untuk memperbarui databaseReloading 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!
(Opsional) Untuk mengakses MySQL dari jarak jauh, pastikan lalu lintas MySQL diizinkan melalui firewall
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) :
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) :
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
7. Tambahkan aturan berikut untuk membuka port 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) :
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) :
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
8 di firewall. Aturan ini tidak boleh ditambahkan jika akses jarak jauh tidak diperlukansudo systemctl status mysql
0sudo systemctl status mysql
1
Masuk ke MySQL sebagai Pengguna Root
Meskipun pengguna
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) :
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) :
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
_0 memiliki akses penuh ke database MySQL, penggunaannya harus dicadangkan untuk tujuan administratif. Ini mengurangi kemungkinan menimpa bagian penting database secara tidak sengaja. Bahkan dalam pengaturan satu pengguna, akun pengguna terpisah harus dibuat untuk sebagian besar aktivitas MySQL
Untuk mengakses server MySQL sebagai pengguna
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) :
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) :
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
_0 dan membuat akun pengguna baru, ikuti langkah-langkah berikut
Gunakan perintah
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)
_1 untuk mengakses database. MySQL mengautentikasi pengguna root berdasarkan kredensial root mereka saat masuk secara lokal, jadi tidak diperlukan kata sandi. Atau, akses akun root menggunakan 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)
_2, bersama dengan kata sandi 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) :
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) :
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
0sudo systemctl status mysql
2MySQL menampilkan nomor rilis dan beberapa informasi tentang penginstalan, lalu menampilkan prompt MySQL
sudo systemctl status mysql
3Untuk mengonfirmasi MySQL beroperasi dengan benar, gunakan perintah
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)
4 untuk menampilkan semua databasesudo systemctl status mysql
4sudo systemctl status mysql
5Buat pengguna baru menggunakan perintah
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)
5. Masukkan nama pengguna dalam format 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)
_6, di mana 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)
7 adalah alamat IP pengguna. Jika pengguna mengakses MySQL dari Linode lokal, gantikan 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)
8 sebagai pengganti Alamat IP. Pada perintah di bawah ini, ganti 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)
_9 dan y
0 dengan nama pengguna dan kata sandi yang sebenarnyaCatatan
MySQL menawarkan beberapa mekanisme otentikasi yang berbeda. Metode
y
_1 direkomendasikan untuk pengguna yang ingin masuk menggunakan kata sandi dan digunakan di sini. Namun, aplikasi lama tertentu mungkin tidak dapat mengautentikasi dengan benar dengan cara ini. Dalam hal ini, y
_2 harus digunakan sebagai gantinya. Replikasi sumber-replika MySQL mungkin memerlukan metode y
3sudo systemctl status mysql
6Berikan akses ke pengguna baru menggunakan perintah
y
4, menggunakan format y
5. Beberapa hak istimewa yang lebih umum meliputi y
_6, y
7, y
8, y
9, Success.
All done!
0, Success.
All done!
1, dan Success.
All done!
2. Untuk menerapkan hak istimewa ini ke semua database, gunakan variabel wildcard Success.
All done!
3. Perintah berikut memberikan hak non-administratif umum pada semua database ke 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)
9sudo systemctl status mysql
7Untuk keluar dari prompt MySQL, ketik
Success.
All done!
5sudo systemctl status mysql
8
Cara Menggunakan MySQL
MySQL menggunakan sintaks SQL standar untuk semua perintahnya. Langkah-langkah di bagian ini menunjukkan cara melakukan tugas dasar di MySQL, seperti membuat database, tabel, dan menambahkan data. Untuk informasi lengkap tentang cara menggunakan MySQL, lihat Manual Referensi MySQL. Untuk pengantar singkat namun menyeluruh, cobalah tutorial MySQL
Buat Basis Data
Untuk membuat database, masuk ke MySQL menggunakan akun yang memiliki hak istimewa
y
6. Ganti Success.
All done!
_7 dengan nama pengguna yang Anda buatsudo systemctl status mysql
_9Buat database baru menggunakan perintah ________42______8. Ganti
Success.
All done!
_9 dengan nama yang diinginkan untuk database Andamysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset:>
Active: active (running) since Thu 2021-09-09 12:24:29 UTC; 1h 44min ago
0mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset:>
Active: active (running) since Thu 2021-09-09 12:24:29 UTC; 1h 44min ago
1Untuk mengonfirmasi database baru telah dibuat dengan benar, gunakan
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)
4sudo systemctl status mysql
4mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset:>
Active: active (running) since Thu 2021-09-09 12:24:29 UTC; 1h 44min ago
3Tunjukkan database yang ingin Anda kerjakan menggunakan perintah
sudo systemctl status mysql
01. Ganti Success.
All done!
_9 dengan nama database yang baru saja Anda buatmysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset:>
Active: active (running) since Thu 2021-09-09 12:24:29 UTC; 1h 44min ago
4mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset:>
Active: active (running) since Thu 2021-09-09 12:24:29 UTC; 1h 44min ago
5Catatan
Anda juga dapat menggunakan perintah
sudo systemctl status mysql
_01 ketika Anda memiliki lebih dari satu database dan Anda ingin beralih di antara merekaUntuk mengetahui nama database saat ini, gunakan perintah
sudo systemctl status mysql
04. Output menampilkan nama databasemysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset:>
Active: active (running) since Thu 2021-09-09 12:24:29 UTC; 1h 44min ago
6mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset:>
Active: active (running) since Thu 2021-09-09 12:24:29 UTC; 1h 44min ago
7
Buat Tabel
Pada titik ini, basis data,
Success.
All done!
9 tidak memiliki tabel apa pun, sehingga belum memungkinkan untuk menyimpan data apa pun di dalamnya. Untuk menentukan tabel, gunakan perintah ________20______06. Bersamaan dengan nama tabel, perintah ini membutuhkan nama dan tipe data dari setiap field. Tipe data mencirikan data yang disimpan di lapangan. Misalnya, tipe data bisa berupa string dengan panjang variabel, dikenal sebagai
sudo systemctl status mysql
07. Untuk daftar lengkap tipe data, lihat dokumentasi MySQL. Beberapa tipe data yang lebih umum adalah sebagai berikut
- INT. Ini dapat berisi nilai antara
sudo systemctl status mysql
_08 dan sudo systemctl status mysql
09. Jika ditentukan sebagai sudo systemctl status mysql
_10, dapat menyimpan nilai antara sudo systemctl status mysql
11 dan sudo systemctl status mysql
12 - KECIL. Memegang nilai bilangan bulat yang lebih kecil antara
sudo systemctl status mysql
13 dan sudo systemctl status mysql
14 - MENGAMBANG. Jenis ini dapat menyimpan nomor floating-point
- TANGGAL. Menyimpan tanggal dalam format
sudo systemctl status mysql
15 - TANGGAL WAKTU. Menyimpan kombinasi tanggal dan waktu dalam format ________20______16. Waktu yang sama dapat disimpan tanpa tanda hubung dan titik dua dalam format
sudo systemctl status mysql
17 - VARCHAR(N). Ini adalah string panjang variabel antara
sudo systemctl status mysql
_18 dan sudo systemctl status mysql
19 karakter, dengan panjang maksimum sudo systemctl status mysql
20 karakter - TEKS. Tipe data ini menampung hingga
sudo systemctl status mysql
_21 karakter. Itu dapat menyimpan teks, gambar, atau data biner - CHAR(N). Jenis ini mewakili bidang teks panjang tetap dengan panjang
sudo systemctl status mysql
19. Misalnya, untuk menyimpan kode status dua karakter, gunakan tipe data sudo systemctl status mysql
23
Sebelum membuat tabel apa pun, penting untuk memutuskan skema untuk database. Skema menjelaskan apa yang diwakili oleh setiap tabel, data apa yang disimpan di setiap tabel, dan bagaimana tabel tersebut berhubungan. Untuk membuat tabel, ikuti langkah-langkah berikut
Saat masuk ke MySQL, alihkan ke database tempat Anda ingin menambahkan tabel
mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset:>
Active: active (running) since Thu 2021-09-09 12:24:29 UTC; 1h 44min ago
8Gunakan perintah
sudo systemctl status mysql
_06 untuk membuat tabel baru. Gunakan format sudo systemctl status mysql
_25mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset:>
Active: active (running) since Thu 2021-09-09 12:24:29 UTC; 1h 44min ago
9sudo mysql_secure_installation
0Untuk mengonfirmasi tabel sekarang ada, gunakan perintah ________20______26
sudo mysql_secure_installation
1sudo mysql_secure_installation
2Untuk meninjau struktur tabel dan memverifikasi daftar bidang, gunakan perintah
sudo systemctl status mysql
27sudo mysql_secure_installation
3sudo mysql_secure_installation
4Jika tabel tidak lagi diperlukan, hapus menggunakan perintah
sudo systemctl status mysql
28Penting
Saat tabel dijatuhkan, semua data di dalam tabel hilang dan tidak dapat dipulihkan
sudo mysql_secure_installation
5
Tambah dan Ambil Data
Cara utama untuk menyisipkan baris data baru ke dalam tabel adalah dengan perintah
y
9
Untuk menambahkan baris, gunakan perintah ________41______9. Tentukan nama tabel, kata kunci
sudo systemctl status mysql
_31, dan daftar nilai yang dipisahkan koma dalam format sudo systemctl status mysql
32. Nilai kolom harus memiliki urutan yang sama dengan definisi tabel, dengan nilai string dan tanggal dalam tanda kutip. Misalnya, untuk menambahkan data ke sudo systemctl status mysql
_33, tentukan nilai untuk ________20______34, sudo systemctl status mysql
35, sudo systemctl status mysql
36, dan sudo systemctl status mysql
37, dalam urutan tersebutsudo mysql_secure_installation
6sudo mysql_secure_installation
7Untuk mengambil data, gunakan perintah
Success.
All done!
2, bersama dengan beberapa batasan yang memberi tahu MySQL baris mana yang akan dikembalikan. Seluruh isi tabel dapat dikembalikan, atau hanya sebagian saja. Untuk memilih semua baris dalam sebuah tabel, gunakan perintah sudo systemctl status mysql
39, tetapi jangan menambahkan kualifikasi apa punsudo mysql_secure_installation
8sudo mysql_secure_installation
9Dimungkinkan juga untuk hanya memilih baris yang sesuai dengan kriteria tertentu, misalnya, di mana kolom diatur ke nilai tertentu. Gunakan kata kunci
sudo systemctl status mysql
_40 sebagai kualifikasi, diikuti dengan kriteria kecocokan sebagai kendala. Dalam contoh ini, hanya baris yang sudo systemctl status mysql
35 disetel ke sudo systemctl status mysql
42 yang ditampilkanVALIDATE PASSWORD COMPONENT 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 component?
0VALIDATE PASSWORD COMPONENT 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 component?
1Untuk tabel dengan banyak kolom, seringkali lebih mudah untuk membatasi informasi yang ditampilkan. Untuk hanya memilih kolom tertentu untuk setiap baris, tentukan nama kolom, bukan simbol
sudo systemctl status mysql
43________14sudo apt upgrade
_14_______3Untuk mengubah baris dalam tabel, gunakan perintah
Success.
All done!
0. Kata kunci sudo systemctl status mysql
_45 menunjukkan kolom yang akan diperbarui dan nilai baru. Jika perlu, kata kunci sudo systemctl status mysql
_40 menyediakan metode untuk membatasi operasi agar hanya berlaku untuk baris tertentu. Dalam contoh berikut, nilai sudo systemctl status mysql
_37 hanya diubah menjadi sudo systemctl status mysql
48 jika sudo systemctl status mysql
35 sama dengan sudo systemctl status mysql
42________14sudo apt upgrade
_14_______5Pernyataan ________20______39 dapat digunakan untuk mengonfirmasi pembaruan
sudo mysql_secure_installation
8VALIDATE PASSWORD COMPONENT 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 component?
7
Kesimpulan. MySQL di Ubuntu 20. 04
MySQL adalah pilihan yang baik untuk aplikasi web berukuran kecil hingga menengah. Ini menggunakan bahasa pemrograman SQL standar industri, yang cukup mudah digunakan. MySQL sangat stabil dan kuat dan memiliki banyak sumber daya bersama dengan dukungan yang baik. Alternatif utama untuk MySQL adalah MariaDB. Ini menampilkan kinerja yang lebih baik dan fitur yang lebih baru, tetapi tidak terlalu mapan
Anda dapat dengan mudah mengunduh dan menginstal server MySQL di Ubuntu menggunakan paket
Please set the password for root here.
New password:
Re-enter new password:
0 dan utilitas
Please set the password for root here.
New password:
Re-enter new password:
3. Bahkan jika Anda adalah satu-satunya orang yang menggunakan MySQL, yang terbaik adalah membuat pengguna MySQL baru dengan hak istimewa yang lebih terbatas
Untuk menggunakan MySQL, pertama-tama tentukan skema database dan tentukan isi tabelnya. Selanjutnya, buat database dan tabel datanya. Data dapat ditambahkan menggunakan perintah
y
9, dimodifikasi menggunakan perintah
Success.
All done!
0, dan diambil menggunakan perintah
Success.
All done!
2. Tentu saja, MySQL dapat melakukan operasi yang sangat rumit sekalipun. Pelajari tutorial MySQL untuk memulai, dan lihat dokumentasi MySQL untuk ikhtisar lengkap
Anda mungkin ingin berkonsultasi dengan sumber daya berikut untuk informasi tambahan tentang topik ini. Meskipun ini disediakan dengan harapan akan berguna, harap diperhatikan bahwa kami tidak dapat menjamin keakuratan atau ketepatan waktu materi yang dihosting secara eksternal
Bagaimana cara menginstal MySQL dari sumber?
Mengekstrak Arsip Instal
Membuat File Opsi
Memilih Jenis Server MySQL
Inisialisasi Direktori Data
Memulai Server untuk Pertama Kalinya
Memulai MySQL dari Baris Perintah Windows
Menyesuaikan PATH untuk Alat MySQL
Memulai MySQL sebagai Layanan Windows
Cara menginstal MySQL5. 7 di Ubuntu 20. 04 menggunakan terminal?
Cara Memasang MySQL 5. 7 pada .
1 - Unduh dan instal server dan klien MySQL
2 - Amankan akun pengguna root MySQL Anda
3 – Periksa versi MySQL
4 - Tambahkan pengguna MySQL dan atur hak istimewa
5 - Uji MySQL 5. 7
6 – Masuk ke server MySQL Anda
Bagaimana cara menginstal MySQL dari baris perintah?
Menginstal MySQL Shell dengan Repositori MySQL APT .
Perbarui informasi paket untuk repositori MySQL APT. sudo apt-get pembaruan
Perbarui paket konfigurasi repositori MySQL APT dengan perintah berikut. sudo apt-get install mysql-apt-config. .
Instal MySQL Shell dengan perintah ini. sudo apt-get install mysql-shell
Bagaimana cara mengunduh MySQL dari terminal Ubuntu?
Buka halaman unduh untuk repositori MySQL APT di https. //dev. mysql. com/unduh/repo/apt/. Pilih dan unduh paket rilis untuk distribusi Linux Anda . Perhatikan bahwa paket yang sama berfungsi pada semua platform Debian dan Ubuntu yang didukung.