Mysql: Difference between revisions
No edit summary |
No edit summary |
||
(One intermediate revision by one other user not shown) | |||
Line 12: | Line 12: | ||
NB: localhost means *really* localhost -- it means that only logins are allowed from the same machine and is a *good idea* for most uses. | NB: localhost means *really* localhost -- it means that only logins are allowed from the same machine and is a *good idea* for most uses. | ||
This creates a database named FOO with user FOOUSER and password FOOPASS; | This creates a database named FOO with user FOOUSER and password FOOPASS; | ||
==Create user== | |||
CREATE USER 'USERNAME'@'localhost' IDENTIFIED BY 'PASSWORD'; | |||
== To dump the database == | == To dump the database == | ||
<source lang="bash"> | <source lang="bash"> | ||
mysqldump -u FOOUSER > foodump.sql | mysqldump -u FOOUSER FOO > foodump.sql | ||
gzip foodump.sql | gzip foodump.sql | ||
</source> | </source> |
Latest revision as of 16:11, 9 February 2021
Create a database + user for a project
sudo su
mysql -u root
create database FOO;
grant all on FOO.* to FOOUSER@'localhost' identified by 'FOOPASS';
NB: localhost means *really* localhost -- it means that only logins are allowed from the same machine and is a *good idea* for most uses. This creates a database named FOO with user FOOUSER and password FOOPASS;
Create user
CREATE USER 'USERNAME'@'localhost' IDENTIFIED BY 'PASSWORD';
To dump the database
mysqldump -u FOOUSER FOO > foodump.sql
gzip foodump.sql