MySQL - dogtagpki/pki GitHub Wiki
To install MySQL client:
$ dnf install community-mysql
To install MySQL server from the operating system distribution:
$ dnf install community-mysql-server
To install MySQL from upstream distribution:
$ cat > /etc/yum.repos.d/mysql-community.repo << EOF [mysql-5.7-community] name=MySQL 5.7 Community Server baseurl=http://repo.mysql.com/yum/mysql-5.7-community/fc/$releasever/$basearch/ enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql EOF
Alternatively, download the files directly from upstream repository:
$ dnf localinstall *.rpm
To start the server:
$ systemctl start mysqld
It will create the initial files in /var/lib/mysql
and store the logs in /var/log/mysql
.
$ systemctl enable mysqld
To connect to a local MySQL server:
$ mysql -u root
To set up SSH tunnel:
$ ssh -N -L 3306:127.0.0.1:3306 <username>@<hostname>
To set up a port forwarding for OpenShift:
$ oc port-forward <pod> 3306
To lock a database:
$ mysql -u root <database> mysql> flush tables with read lock; mysql> set global read_only = ON; mysql> exit;
To unlock a database:
$ mysql -u root <database> mysql> set global read_only = OFF; mysql> unlock tables; mysql> exit;
$ mysqldump -u root <database> > backup.sql
$ mysql -u root -p <database> < backup.sql