.Dd Created:2026-03-24|Updated:2026-03-25| .de ocsi \\$* , .. .de oxr .ocsi .Xr \\$* .. .de oit .It \\$* .. .de obdi .Bl -dash -compact .oit \\$* .. .de obdl .Bd -literal -compact \\$* .. .de onote .Bl -hang -compact .oit \\$* .El .. .de ocomm .Bl -diag -compact .oit \\$* .El .. .de opsy .Pp .Sy - \\$* .. .de obc .Bl -column \\$* .. .de obc2 .obc opt desc .. .de obc3 .obc option arguments description .. .Dt MYSQL oh .Os linux , OpenBSD 7.8 | .Nm MySQL .Nd usage and tips .Sh COMMANDS .Bd -literal -compact show databases; show tables; show tables like '%pattern%' .Ed .Sh USERS .obdl CREATE DATABASE db_name; CREATE USER 'username'@'localhost' IDENTIFIED BY 'new_password' PASSWORD EXPIRE; mysql> GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP -> ON db_name.* -> TO 'username'@'localhost'; .Ed .Sh EXECUTE Executing commands on mysql from a file. .Dl $ cat FILE | sudo mysql .Sh READ Use a SQL file to update database. .Dl $ sudo mysql DATABASE < FILE.sql .Sh BACKUP Backup a database: .Dl # mysqldump -p DATABASE > FILE.sql The argument -p specifies a password, if not given, mysqldump prompts the user to enter a password. .Ss Compress backup .Dl # mysqldump DATABASE | gzip > FILE.sql.gz .Sh TIMEZONES Adding timezones to mysql: .Dl $ mysql_tzinfo_to_sql /usr/share/zoneinfo | sudo mysql mysql .Sh SEE ALSO .Xr sql oh .opsy Archlinux manpages: .Xr mysql 1 .Ss links .obc2 .It - Lk https://dev.mysql.com/ MySQL .It - Lk https://dev.mysql.com/doc/refman/8.4/en/create-user.html MySQL - CREATE USER .El .Sh AUTHORS .An -nosplit .Xr ohazot oh | .Xr about oh | .Lk https://ohazot.com ohazot.com .Aq Mt admin@ohazot.com