Created
May 15, 2024 12:54
-
-
Save t-ubukata/5594336ac2b030977c97475d2852b174 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Status. | |
systemctl status mysql | |
# Start. | |
systemctl start mysql | |
# Stop. | |
systemctl stop mysql | |
# Restart. | |
systemctl restart mysql | |
# Connects. | |
mysql -u user -p -h hostname -p port -D db | |
# Runs a query. | |
mysql -u user -p -h hostname -p port -D db -e "select * from foo;" | |
# Runs a file. | |
mysql -u user -p -h hostname -p port -D db < foo.sql | |
# MySQL commands. | |
## Help. | |
\h | |
## Quits. | |
\q | |
## Lists databases. | |
show databases; | |
## Lists tables. | |
show tables; | |
## Shows table definition. | |
desc foo; | |
## Shows data directory. | |
select @@datadir; | |
# Config file. | |
/etc/my.cnf | |
/etc/mysql/my.cnf | |
SYSCONFDIR/my.cnf | |
$MYSQL_HOME/my.cnf | |
defaults-extra-file | |
~/.my.cnf | |
~/.mylogin.cnf | |
DATADIR/mysqld-auto.cnf | |
## Data directory setting. | |
datatdir | |
## Log setting. | |
log-error | |
general_log_file | |
log-bin | |
slow_query_log_file |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment