# 1. stop mysqld service
# after this command, remember to double check if /var/run/mysqld folder exists and its owner is mysql:mysql
sudo /etc/init.d/mysql stop
# might have to do this
sudo mkdir -p /var/run/mysqld
sudo chown mysql:mysql /var/run/mysqld
# 2. start mysql without password
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
"‐a".each_codepoint do |c| | |
if c & 0xff80 != 0 | |
puts "#{c} is non-ASCII char" | |
end | |
end |
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
#!/bin/sh | |
set -e | |
if [ -e /.installed ]; then | |
echo 'Already installed.' | |
else | |
echo '' | |
echo 'INSTALLING' | |
echo '----------' |
pg_createcluster --start -e UTF-8 8.4 main
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
sudo rm /etc/exports | |
sudo touch /etc/exports | |
vagrant reload |
cd to target directory, run the following commands to start using git version control:
# start a local repository
git init
# add all files under directory to git repository
git add .
# commit the current version
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
update pg_database set datistemplate=false where datname='template1'; | |
drop database Template1; | |
-- if it complains the locale name -- run `locale -a` to list all locale names in terminal | |
create database template1 with owner=postgres encoding='UTF-8' lc_collate='en_US.utf8' lc_ctype='en_US.utf8' template template0; | |
update pg_database set datistemplate=true where datname='template1'; |
-
Query table size:
SELECT relname AS table_name, pg_size_pretty(pg_total_relation_size(relid)) AS total_size, pg_size_pretty(pg_relation_size(relid)) AS data_size, pg_size_pretty(pg_total_relation_size(relid) - pg_relation_size(relid)) AS index_size FROM pg_stat_user_tables
OlderNewer