Page:  
Apr
15

Removing Asterisk on Ubuntu 6,8

This little recipe works for me if you’re not using any special hardware.

Run these commands as root or use sudo. This will work for Asterisk 1.4 and 1.6.


sudo killall -9 safe_asterisk
sudo killall -9 asterisk
sudo rm -rf /var/log/asterisk
sudo rm -rf /var/lib/asterisk
sudo rm -rf /var/spool/asterisk
sudo rm -rf /usr/lib/asterisk
sudo rm -rf /etc/asterisk
sudo rm /usr/sbin/asterisk
sudo rm /usr/sbin/safe_asterisk

Now you should be clean and ready to reinstall if needed.

Mar
2

Installing MySQL for Python on Mac OS X (MySQLdb)

I was having issues setting up MySQL Python when I was setting up a Django development environment on Mac OS X. This works fine on Ubuntu and Windows Machines, but it appears installing Python’s MySQL (MySQLdb) can be difficult on Mac OS.  See this post http://forums.mysql.com/read.php?50,175059,179979

It tried the following compilation but it ran with some errors:

http://www.keningle.com/?p=11

Anyhow a bunch of people have had problems with this.  Here is what I did to get it to work nice and easy:

Download this file. mysql_python-122-py25-macosx-105-i386.egg Install this egg file to file: to /Library/Python/2.5/site-packages/. So open up a terminal shell and do something like:


sudo cp mysql_python-122-py25-macosx-105-i386.egg /Library/Python/2.5/site-packages/

Now create and edit a text file here /Library/Python/2.5/site-packages/myeggs.pth:


sudo nano /Library/Python/2.5/site-packages/myeggs.pth

Now put the full path to the egg in the file:


/Library/Python/2.5/site-packages/mysql_python-122-py25-macosx-105-i386.egg

Save the file:


ctrl-x
Save changes? Y

That’s it. All should be working. Compiling Python_MySql from scratch should not be necessary. If you are using Django, you can test this with:

python manage.py syncdb

You can also test it just using Python by:

python
>>> import MySQLdb
>>>

If you see no error, then the library is present. If you see “ImportError: No module named MySQLdb”, then something has gone wrong.

Change the above based on your local settings. Happy coding.

-Alan

Feb
26

How to create a MySQL database and users from the command line

Create the database with the mysqladmin tool.
Don’t forget to add the bin folder to your path if you are on Windows or Mac!  Not necessary on Linux.
For example, on my Windows box it is C:Program FilesMySQLMySQL Server 5.1bin

mysqladmin --user=root --pass=some_pass create local_db

(replace “some_pass” with your mysql root password.)

now login to my sql as root..
mysql --user=root --pass=some_pass

now change to the new db…

mysql>use  local_db;
Database changed.
mysql>

create the user(s) and grant rights ….this allows the user monty to access the database locally and remotely.

mysql> GRANT ALL PRIVILEGES ON *.* TO 'monty'@'localhost'
    ->     IDENTIFIED BY 'some_pass' WITH GRANT OPTION;
mysql> GRANT ALL PRIVILEGES ON *.* TO 'monty'@'%'
    ->     IDENTIFIED BY 'some_pass' WITH GRANT OPTION;
Page: