Archive for the ‘MySQL’ Category
How To Install MariaDB on CentOS 7
[root@voice teee]# yum -y install mariadb-server mariadb.x86_64 mariadb-devel.x86_64 mariadb-libs.x86_64
[root@voice teee]# systemctl restart mariadb
[root@voice teee]# netstat -lntup
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 31899/mysqld
[root@voice teee]# mysql_secure_installation
Enter current password for root (enter for none):
Set root password? [Y/n] y
New password:
Re-enter new password:
Remove anonymous users? [Y/n] y
Disallow root login remotely? [Y/n] y
Remove test database and access to it? [Y/n] y
Reload privilege tables now? [Y/n] y
[root@voice teee]# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 10
Server version: 5.5.60-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 databases;
+——————–+
| Database |
+——————–+
| information_schema |
| mysql |
| performance_schema |
+——————–+
3 rows in set (0.00 sec)
[root@voice teee]# systemctl enable mariadb
[root@voice teee]# systemctl status mariadb
INSTALL MYSQL ODBC CONNECTOR TO DEBIAN 10.x
root@teee:~# wget https://dev.mysql.com/get/Downloads/Connector-ODBC/8.0/mysql-connector-odbc-8.0.18-linux-debian10-x86-64bit.tar.gz
root@teee:~# tar xvf mysql-connector-odbc-8.0.18-linux-debian10-x86-64bit.tar.gz
root@teee:~# cd mysql-connector-odbc-8.0.18-linux-debian10-x86-64bit/lib/
root@teee:/usr/lib64# cd /usr/lib64/
root@teee:/usr/lib64# mkdir odbc
root@teee:/usr/lib64/odbc# cp /root/mysql-connector-odbc-8.0.18-linux-debian10-x86-64bit/lib/libmy* .
root@teee:/usr/lib64/odbc# ls
libmyodbc8a.so libmyodbc8S.so libmyodbc8w.so
Install:
root@teee:/usr/lib64/odbc# /root/mysql-connector-odbc-8.0.18-linux-debian10-x86-64bit/bin/myodbc-installer -d -a -n “MySQL” -t “DRIVER=/usr/lib64/odbc/ libmyodbc8w.so;”
Success: Usage count is 1
Check:
root@teee:/usr/lib64/odbc# /root/mysql-connector-odbc-8.0.18-linux-debian10-x86-64bit/bin/myodbc-installer -s -a -c2 -n “test” -t “DRIVER=MySQL;SERVER=127.0.0.1; DATABASE=mysql;UID=root;PWD=password”
[Result should be “Success”]
root@teee:/usr/lib64/odbc# ee /etc/odbcinst.ini
[MDBTools]
Description=MDBTools Driver
Driver=libmdbodbc.so
Setup=libmdbodbc.so
FileUsage=1
UsageCount=1
[MySQL]
Driver=/usr/lib64/odbc/ libmyodbc8w.so <— NEW INSTALL
UsageCount=1
How to Recovery MySQL Root Password
1 ) Stop MySql Server Service
[root@naitinoi ~]# /etc/init.d/mysqld stop
Stopping mysqld: [ OK ]
2) Start MySQL server w/o password:
[root@naitinoi ~]# mysqld_safe –skip-grant-tables &
[1] 6462
[root@naitinoi ~]# 151105 08:47:32 mysqld_safe Logging to ‘/var/log/mysqld.log’.
151105 08:47:32 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
3) Login as root
[root@naitinoi ~]# mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.x.xx MySQL Community Server (GPL) by Remi
Copyright (c) 2000, 2015, 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.
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
mysql> 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
mysql> update user set password=PASSWORD(“new password here”) where User=’root’;
Query OK, 3 rows affected (0.01 sec)
Rows matched: 3 Changed: 3 Warnings: 0
mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)
mysql> quit
Bye
4) Stop MySQL server w/o password:
[root@naitinoi ~]# /etc/init.d/mysqld stop
151105 08:49:26 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
Stopping mysqld: [ OK ]
[1]+ Done mysqld_safe –skip-grant-tables
5) Start MySql Server Service
[root@naitinoi ~]# /etc/init.d/mysqld start
Starting mysqld: [ OK ]
6) Login
[root@naitinoi ~]# mysql -u root -p
Enter password: