This file contains 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
LOAD DATA LOCAL INFILE '/path/to/file.csv' INTO TABLE <database.table_name> | |
FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\n' | |
(field1, field2, fieldN); |
This file contains 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
### MySQL v5.0 | |
mysqldump -h <host> -u <username> -p <password> <database_name> > backup_db_file.sql | |
mysql -u <username> -p <password> <database_name> < <backup_db_file.sql> | |
### MySQL v5.5 | |
mysqldump -h <host> -u <username> -p <database_name> > backup_db_file.sql | |
mysql --user=<username> --password=<pass> -A <database_name> < <backup_db_file.sql> | |
### MySQL ROOT migrations with secure copy remote | |
mysqldump -u root -p<pass> -B --opt --events --routines --triggers <database_name> | ssh <user>@<remote_host> 'cat - | mysql -u root -p<pass>' |
This file contains 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
CREATE DATABASE `<dbname>` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; | |
CREATE USER <user> IDENTIFIED BY 'password'; | |
GRANT ALL PRIVILEGES ON <dbname>.* TO <user>@localhost; | |
FLUSH PRIVILEGES; |
This file contains 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
SELECT * INTO OUTFILE 'result.csv' | |
FIELDS TERMINATED BY ',' | |
OPTIONALLY ENCLOSED BY '"' | |
ESCAPED BY '\\' | |
LINES TERMINATED BY '\n' | |
FROM <table>; |
This file contains 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
# Get used space amount of directories (-d 1 = recursivity depth) | |
du -c -h -d 1 /path/to/your/dir |
This file contains 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
SELECT table_schema, sum(data_length + index_length)/1024/1024 AS used_space_mb FROM information_schema.TABLES GROUP BY table_schema; |
This file contains 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
#!/bin/bash | |
if [ -z "$1" ] | |
then | |
php app/console doctrine:database:drop --force | |
php app/console doctrine:database:create | |
php app/console doctrine:schema:update --force | |
# php app/console doctrine:migrations:diff | |
# php app/console doctrine:migrations:mig | |
php app/console hautelook_alice:doctrine:fixtures:load -n |
This file contains 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
#!/bin/bash | |
echo "Started at `date +"%T %d/%m/%Y"`" | |
if [ -z "$1" ] | |
then | |
phpunit -c app/ | |
else | |
if [ "$1" = "cc" -o "$1" = "coverage" ] | |
then |
This file contains 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
#!/bin/bash | |
if [ -x "$(command -v php-cs-fixer)" ]; then | |
FILES=`git diff --name-only` | |
printf '%s\n' "$FILES" | while IFS= read -r FILE | |
do | |
if [[ $FILE == "src/"* ]]; then | |
php-cs-fixer fix "$FILE" --rules=@Symfony | |
# git add "$FILE" | |
fi |
This file contains 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
# bash console | |
alias cl="clear" | |
alias lsl="ls -lh" | |
alias lsla="ls -lha" | |
alias sz="du -c -h -d 1" | |
# symfony | |
alias sf="sf2" | |
alias sf2="php app/console" | |
alias sf3="php bin/console" |
OlderNewer