Skip to content

Instantly share code, notes, and snippets.

@rischanlab
Last active August 29, 2015 14:01
Show Gist options
  • Save rischanlab/7c548cddf1b8d0098fe6 to your computer and use it in GitHub Desktop.
Save rischanlab/7c548cddf1b8d0098fe6 to your computer and use it in GitHub Desktop.
Simple MySQL User and DB management
#Dont forget to install this, if you use python to accessing your MySQL db
apt-get install libmysqlclient-dev python-dev
#If you wanna to use python MySQL and tweepy, you can install it
sudo pip install tweepy
sudo pip install MySQL-python
#Change root password
mysql => UPDATE mysql.user SET Password=PASSWORD('password') WHERE User='root'; FLUSH PRIVILEGES;
#example for creating mysql user
CREATE USER 'user'@'localhost' IDENTIFIED BY 'password';
#dont forget to give previlages to the user
GRANT ALL PRIVILEGES ON * . * TO 'user'@'localhost';
FLUSH PRIVILEGES;
#creating table and insert
create table tw ( id int not null auto_increment, tweet varchar(140) not null, primary key (id));
insert into tw(tweet) values('This is my tweet, I am bot but dont worry I will not disturb you :) ')
#you can use cron job to run your bot
grep CRON /var/log/syslog #see log
cronjob: 0,30 * * * * ~/twitter/bot.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment