[lake@izuf6ad1jbc6ftdqtbuiquz opt]$ mysql
-bash: mysql: command not found
[lake@izuf6ad1jbc6ftdqtbuiquz opt]$ rpm -qa |grep mar
mariadb-libs-5.5.56-2.el7.x86_64
[lake@izuf6ad1jbc6ftdqtbuiquz opt]$ rpm -qa |grep mysql
[lake@izuf6ad1jbc6ftdqtbuiquz opt]$ rpm -qa |grep mysql^C
[lake@izuf6ad1jbc6ftdqtbuiquz opt]$ yum install mariadb-server
Failed to set locale, defaulting to C
Loaded plugins: fastestmirror
You need to be root to perform this command.
[lake@izuf6ad1jbc6ftdqtbuiquz opt]$ sudo yum install mariadb-server
[sudo] password for lake:
Failed to set locale, defaulting to C
Loaded plugins: fastestmirror
base | 3.6 kB 00:00:00
epel | 5.4 kB 00:00:00
extras | 2.9 kB 00:00:00
updates | 2.9 kB 00:00:00
(1/7): base/7/x86_64/group_gz | 153 kB 00:00:00
(2/7): epel/x86_64/group_gz | 95 kB 00:00:00
(3/7): epel/x86_64/updateinfo | 1.0 MB 00:00:00
(4/7): extras/7/x86_64/primary_db | 194 kB 00:00:00
(5/7): base/7/x86_64/primary_db | 6.1 MB 00:00:00
(6/7): epel/x86_64/primary_db | 6.8 MB 00:00:00
(7/7): updates/7/x86_64/primary_db | 2.1 MB 00:00:00
Determining fastest mirrors
Resolving Dependencies
--> Running transaction check
---> Package mariadb-server.x86_64 1:5.5.65-1.el7 will be installed
--> Processing Dependency: mariadb-libs(x86-64) = 1:5.5.65-1.el7 for package: 1:mariadb-server-5.5.65-1.el7.x86_64
--> Processing Dependency: mariadb(x86-64) = 1:5.5.65-1.el7 for package: 1:mariadb-server-5.5.65-1.el7.x86_64
--> Processing Dependency: perl-DBI for package: 1:mariadb-server-5.5.65-1.el7.x86_64
--> Processing Dependency: perl-DBD-MySQL for package: 1:mariadb-server-5.5.65-1.el7.x86_64
--> Processing Dependency: perl(Data::Dumper) for package: 1:mariadb-server-5.5.65-1.el7.x86_64
--> Processing Dependency: perl(DBI) for package: 1:mariadb-server-5.5.65-1.el7.x86_64
--> Processing Dependency: libaio.so.1(LIBAIO_0.4)(64bit) for package: 1:mariadb-server-5.5.65-1.el7.x86_64
--> Processing Dependency: libaio.so.1(LIBAIO_0.1)(64bit) for package: 1:mariadb-server-5.5.65-1.el7.x86_64
--> Processing Dependency: libaio.so.1()(64bit) for package: 1:mariadb-server-5.5.65-1.el7.x86_64
--> Running transaction check
---> Package libaio.x86_64 0:0.3.109-13.el7 will be installed
---> Package mariadb.x86_64 1:5.5.65-1.el7 will be installed
---> Package mariadb-libs.x86_64 1:5.5.56-2.el7 will be updated
---> Package mariadb-libs.x86_64 1:5.5.65-1.el7 will be an update
---> Package perl-DBD-MySQL.x86_64 0:4.023-6.el7 will be installed
---> Package perl-DBI.x86_64 0:1.627-4.el7 will be installed
--> Processing Dependency: perl(RPC::PlServer) >= 0.2001 for package: perl-DBI-1.627-4.el7.x86_64
--> Processing Dependency: perl(RPC::PlClient) >= 0.2000 for package: perl-DBI-1.627-4.el7.x86_64
---> Package perl-Data-Dumper.x86_64 0:2.145-3.el7 will be installed
--> Running transaction check
---> Package perl-PlRPC.noarch 0:0.2020-14.el7 will be installed
--> Processing Dependency: perl(Net::Daemon) >= 0.13 for package: perl-PlRPC-0.2020-14.el7.noarch
--> Processing Dependency: perl(Net::Daemon::Test) for package: perl-PlRPC-0.2020-14.el7.noarch
--> Processing Dependency: perl(Net::Daemon::Log) for package: perl-PlRPC-0.2020-14.el7.noarch
--> Processing Dependency: perl(Compress::Zlib) for package: perl-PlRPC-0.2020-14.el7.noarch
--> Running transaction check
---> Package perl-IO-Compress.noarch 0:2.061-2.el7 will be installed
--> Processing Dependency: perl(Compress::Raw::Zlib) >= 2.061 for package: perl-IO-Compress-2.061-2.el7.noarch
--> Processing Dependency: perl(Compress::Raw::Bzip2) >= 2.061 for package: perl-IO-Compress-2.061-2.el7.noarch
---> Package perl-Net-Daemon.noarch 0:0.48-5.el7 will be installed
--> Running transaction check
---> Package perl-Compress-Raw-Bzip2.x86_64 0:2.061-3.el7 will be installed
---> Package perl-Compress-Raw-Zlib.x86_64 1:2.061-4.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
========================================================================================================================
Package Arch Version Repository Size
========================================================================================================================
Installing:
mariadb-server x86_64 1:5.5.65-1.el7 base 11 M
Installing for dependencies:
libaio x86_64 0.3.109-13.el7 base 24 k
mariadb x86_64 1:5.5.65-1.el7 base 8.7 M
perl-Compress-Raw-Bzip2 x86_64 2.061-3.el7 base 32 k
perl-Compress-Raw-Zlib x86_64 1:2.061-4.el7 base 57 k
perl-DBD-MySQL x86_64 4.023-6.el7 base 140 k
perl-DBI x86_64 1.627-4.el7 base 802 k
perl-Data-Dumper x86_64 2.145-3.el7 base 47 k
perl-IO-Compress noarch 2.061-2.el7 base 260 k
perl-Net-Daemon noarch 0.48-5.el7 base 51 k
perl-PlRPC noarch 0.2020-14.el7 base 36 k
Updating for dependencies:
mariadb-libs x86_64 1:5.5.65-1.el7 base 759 k
Transaction Summary
========================================================================================================================
Install 1 Package (+10 Dependent packages)
Upgrade ( 1 Dependent package)
Total download size: 22 M
Is this ok [y/d/N]: y
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
(1/12): libaio-0.3.109-13.el7.x86_64.rpm | 24 kB 00:00:00
(2/12): mariadb-libs-5.5.65-1.el7.x86_64.rpm | 759 kB 00:00:00
(3/12): mariadb-5.5.65-1.el7.x86_64.rpm | 8.7 MB 00:00:00
(4/12): perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64.rpm | 32 kB 00:00:00
(5/12): perl-Compress-Raw-Zlib-2.061-4.el7.x86_64.rpm | 57 kB 00:00:00
(6/12): perl-DBD-MySQL-4.023-6.el7.x86_64.rpm | 140 kB 00:00:00
(7/12): perl-DBI-1.627-4.el7.x86_64.rpm | 802 kB 00:00:00
(8/12): perl-Data-Dumper-2.145-3.el7.x86_64.rpm | 47 kB 00:00:00
(9/12): perl-IO-Compress-2.061-2.el7.noarch.rpm | 260 kB 00:00:00
(10/12): perl-Net-Daemon-0.48-5.el7.noarch.rpm | 51 kB 00:00:00
(11/12): perl-PlRPC-0.2020-14.el7.noarch.rpm | 36 kB 00:00:00
(12/12): mariadb-server-5.5.65-1.el7.x86_64.rpm | 11 MB 00:00:00
------------------------------------------------------------------------------------------------------------------------
Total 31 MB/s | 22 MB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Updating : 1:mariadb-libs-5.5.65-1.el7.x86_64 1/13
Installing : perl-Data-Dumper-2.145-3.el7.x86_64 2/13
Installing : 1:mariadb-5.5.65-1.el7.x86_64 3/13
Installing : libaio-0.3.109-13.el7.x86_64 4/13
Installing : 1:perl-Compress-Raw-Zlib-2.061-4.el7.x86_64 5/13
Installing : perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64 6/13
Installing : perl-IO-Compress-2.061-2.el7.noarch 7/13
Installing : perl-Net-Daemon-0.48-5.el7.noarch 8/13
Installing : perl-PlRPC-0.2020-14.el7.noarch 9/13
Installing : perl-DBI-1.627-4.el7.x86_64 10/13
Installing : perl-DBD-MySQL-4.023-6.el7.x86_64 11/13
Installing : 1:mariadb-server-5.5.65-1.el7.x86_64 12/13
Cleanup : 1:mariadb-libs-5.5.56-2.el7.x86_64 13/13
Verifying : 1:mariadb-server-5.5.65-1.el7.x86_64 1/13
Verifying : perl-Net-Daemon-0.48-5.el7.noarch 2/13
Verifying : perl-Data-Dumper-2.145-3.el7.x86_64 3/13
Verifying : perl-DBD-MySQL-4.023-6.el7.x86_64 4/13
Verifying : perl-IO-Compress-2.061-2.el7.noarch 5/13
Verifying : 1:mariadb-libs-5.5.65-1.el7.x86_64 6/13
Verifying : perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64 7/13
Verifying : 1:perl-Compress-Raw-Zlib-2.061-4.el7.x86_64 8/13
Verifying : perl-DBI-1.627-4.el7.x86_64 9/13
Verifying : libaio-0.3.109-13.el7.x86_64 10/13
Verifying : perl-PlRPC-0.2020-14.el7.noarch 11/13
Verifying : 1:mariadb-5.5.65-1.el7.x86_64 12/13
Verifying : 1:mariadb-libs-5.5.56-2.el7.x86_64 13/13
Installed:
mariadb-server.x86_64 1:5.5.65-1.el7
Dependency Installed:
libaio.x86_64 0:0.3.109-13.el7 mariadb.x86_64 1:5.5.65-1.el7
perl-Compress-Raw-Bzip2.x86_64 0:2.061-3.el7 perl-Compress-Raw-Zlib.x86_64 1:2.061-4.el7
perl-DBD-MySQL.x86_64 0:4.023-6.el7 perl-DBI.x86_64 0:1.627-4.el7
perl-Data-Dumper.x86_64 0:2.145-3.el7 perl-IO-Compress.noarch 0:2.061-2.el7
perl-Net-Daemon.noarch 0:0.48-5.el7 perl-PlRPC.noarch 0:0.2020-14.el7
Dependency Updated:
mariadb-libs.x86_64 1:5.5.65-1.el7
Complete!
[lake@izuf6ad1jbc6ftdqtbuiquz opt]$
[lake@izuf6ad1jbc6ftdqtbuiquz opt]$ systemctl status mariadb
● mariadb.service - MariaDB database server
Loaded: loaded (/usr/lib/systemd/system/mariadb.service; disabled; vendor preset: disabled)
Active: inactive (dead)
[lake@izuf6ad1jbc6ftdqtbuiquz opt]$ systemctl start mariadb
==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===
Authentication is required to manage system services or units.
Authenticating as: root
Password:
[lake@izuf6ad1jbc6ftdqtbuiquz opt]$ sudo systemctl start mariadb
[lake@izuf6ad1jbc6ftdqtbuiquz opt]$ systemctl start mariadb
==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===
Authentication is required to manage system services or units.
Authenticating as: root
Password:
[lake@izuf6ad1jbc6ftdqtbuiquz opt]$ systemctl status mariadb
● mariadb.service - MariaDB database server
Loaded: loaded (/usr/lib/systemd/system/mariadb.service; disabled; vendor preset: disabled)
Active: active (running) since Mon 2020-06-15 14:42:10 CST; 5s ago
Process: 15489 ExecStartPost=/usr/libexec/mariadb-wait-ready $MAINPID (code=exited, status=0/SUCCESS)
Process: 15406 ExecStartPre=/usr/libexec/mariadb-prepare-db-dir %n (code=exited, status=0/SUCCESS)
Main PID: 15488 (mysqld_safe)
CGroup: /system.slice/mariadb.service
├─15488 /bin/sh /usr/bin/mysqld_safe --basedir=/usr
└─15651 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin -...
[lake@izuf6ad1jbc6ftdqtbuiquz opt]$ sudo systemctl enable mariadb
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.
[lake@izuf6ad1jbc6ftdqtbuiquz opt]$ netstat -an --tcp |grep 3306
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN
[lake@izuf6ad1jbc6ftdqtbuiquz opt]$ mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 5.5.65-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> quit
Bye
mysql_secure_installation
[lake@izuf6ad1jbc6ftdqtbuiquz opt]$ mysql_
mysql_convert_table_format mysql_install_db mysql_setpermission mysql_waitpid
mysql_find_rows mysql_plugin mysql_tzinfo_to_sql mysql_zap
mysql_fix_extensions mysql_secure_installation mysql_upgrade
[lake@izuf6ad1jbc6ftdqtbuiquz opt]$ mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none):
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.
Set root password? [Y/n] Y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
... Success!
By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB 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? [Y/n] 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? [Y/n] y
... Success!
By default, MariaDB 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? [Y/n] 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? [Y/n] y
... Success!
Cleaning up...
All done! If you've completed all of the above steps, your MariaDB
installation should now be secure.
Thanks for using MariaDB!
[lake@izuf6ad1jbc6ftdqtbuiquz opt]$
[lake@izuf6ad1jbc6ftdqtbuiquz opt]$ mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 11
Server version: 5.5.65-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
MariaDB [mysql]> select user from mysql.user;
+------+
| user |
+------+
| root |
| root |
| root |
+------+
3 rows in set (0.00 sec)
MariaDB [mysql]>
UTF-8
[lake@izuf6ad1jbc6ftdqtbuiquz opt]$ mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 11
Server version: 5.5.65-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
MariaDB [mysql]> select user from mysql.user;
+------+
| user |
+------+
| root |
| root |
| root |
+------+
3 rows in set (0.00 sec)
MariaDB [mysql]>
[lake@izuf6ad1jbc6ftdqtbuiquz opt]$ mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 12
Server version: 5.5.65-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> show variables like 'character%'
-> ;
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | latin1 |
| character_set_connection | latin1 |
| character_set_database | latin1 |
| character_set_filesystem | binary |
| character_set_results | latin1 |
| character_set_server | latin1 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.00 sec)
MariaDB [(none)]> quit
Bye
[lake@izuf6ad1jbc6ftdqtbuiquz opt]$ vi /etc/my.cnf
#character
init_connect='SET collation_connection = utf8_unicode_ci'
init_connect='SET NAMES utf8'
character-set-server=utf8
collation-server=utf8_unicode_ci
skip-character-set-client-handshake
[lake@izuf6ad1jbc6ftdqtbuiquz opt]$ cd /etc/my.cnf.d/
[lake@izuf6ad1jbc6ftdqtbuiquz my.cnf.d]$ ls
client.cnf mysql-clients.cnf server.cnf
[lake@izuf6ad1jbc6ftdqtbuiquz my.cnf.d]$ vi client.cnf
#character
default-character-set=utf8
[lake@izuf6ad1jbc6ftdqtbuiquz my.cnf.d]$ sudo systemctl restart mysqld
Failed to restart mysqld.service: Unit not found.
[lake@izuf6ad1jbc6ftdqtbuiquz my.cnf.d]$ sudo systemctl restart ^C
[lake@izuf6ad1jbc6ftdqtbuiquz my.cnf.d]$ sudo systemctl restart mariadb
[lake@izuf6ad1jbc6ftdqtbuiquz my.cnf.d]$ mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 5.5.65-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> show variables like 'character%'
-> ;
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.00 sec)
MariaDB [(none)]>