Backup MySQL by Time Interval with Bash Script and Crontab

MySQL, 2016-04-04 02:32:00 UTC
1. Create bash script; b=$(date +"%Y-%m-%d") c=".sql" mysqldump -uroot -pSecret123 --opt db_one > /home/myname/backup/db_one-$b$c mysqldump -uroot -pSecret123 --opt db_two > /home/myname/backup/db_two-$b$c   2. Create Crontab; $ crontab -e   In crontab file, add thi
Share:     

Enabling remote connection of MySQL on Ubuntu

Linux, MySQL, Ubuntu, 2015-06-17 00:16:48 UTC
1. open mysql configuration $ sudo nano /etc/mysql/my.cnf 2. We need to comment out the bind-address and skip-external-locking lines: #bind-address = 127.0.0.1 # skip-external-locking 3. Restart MySQL to make changes; sudo service mysql restart 4. Grant permission to root fro
Share:     

How to add a user and grant database on MySQL

MySQL, 2015-06-17 00:16:13 UTC
1. Create user $ mysql -u root -p Enter password: mysql> create user name@localhost identified by 'write password'; 2. Grant specific database to a user mysql> GRANT ALL PRIVILEGES ON database_name.* TO name@localhost WITH GRANT OPTION ; mysql> FLUSH PRIVILEGES;  
Share:     

Override Rails Table name

MySQL, Ruby on Rails, 2015-05-24 01:48:39 UTC
I don't know exactly what does this name in Rails. But, I named it override table name in Rails. The case is very simple, let say We already have a table name in the database. The database name is email_dr_pengunjung. When We create it with rails g model command, Rails simple add s in the end of table name. So, the table name is email_dr_pengunjungs and the migration file like 20150523233040_create_email_dr_pengunjungs.rb $ rails g model EmailDrPengunjung Just open up 20150523233040_create_email_dr_pengunjungs.rb to force using 'the old table name'. And add these lines; class CreateEmailDrPengunjungs < ActiveRecord::Migration def change self.connection.execute %Q( CREATE TABLE IF NOT EXISTS `email_dr_pengunjung` ( `id` int(10) NOT NULL AUTO_INCREMENT, `email` varchar(255) DEFAULT NULL, `nama_lengkap` varchar(255) DEFAULT NULL,
Share: