On the road again

Some useful MySQL commands

apt-get install mysql-server
mysql_secure_installation ##security settings
Config directory:
Connect as root:
mysql -u root -p
Find out DB directory:
mysql -u root -p
select @@datadir;
View all databases:
show databases;
View all tables in DB:
show tables;
View all users:
select host, user, password from mysql.user;
Create database: 
Create user, grant permissions: 
GRANT ALL ON owncloud.* to 'owncloud'@'localhost' IDENTIFIED BY 'djkujuhf9';
Update statement:
update ml2_port_bindings set vif_type="unbound" where port_id="e5e3906b-24d8-4642-9876-2ac06f984809";
Import DB dump:
mysql -u username -p database_name < file.sql
Export specific row)s) to a file:
SELECT * INTO OUTFILE '/tmp/result.txt' from j3_extensions where name="plg_captcha_recaptcha";
Import data from file previously exported by above command:
LOAD DATA INFILE '/tmp/result.txt' INTO TABLE j17_extensions;
Добавить комментарий