MySQL Administration and Usage
Basic commands to deal with MySQL database server in Ubuntu environment
- This command will install MySQL server (and some client tools) on an empty Ubuntu machine:
sudo apt-get install mysql-server
If you have installed Ubuntu as a LAMP server, then you do not need to install anything. But for desktop machines this command is common and useful. During installation you will need to enter "root" password. It is important to remember it for later use.
- Use these commands to create a new database - collection of tables, which can be administered as a single unit. The database is called "solidaritate". In order to avoid using "root" account, there is a new user "solidaritate" with password "solidaritate" created.
CREATE DATABASE solidaritate CHARACTER SET utf8 COLLATE utf8_general_ci;
GRANT ALL PRIVILEGES ON solidaritate.* TO 'solidaritate'@'127.0.0.1' IDENTIFIED BY 'solidaritate';
GRANT ALL PRIVILEGES ON solidaritate.* TO 'solidaritate'@'localhost' IDENTIFIED BY 'solidaritate';
FLUSH PRIVILEGES;
- If some further installations complain about missing "mysql_config" file, then run additionally:
sudo apt-get install libmysqlclient15-dev
Making MySQL available from Python
sudo apt-get install python-dev
sudo apt-get install zope3
- Install the egg file with drivers:
sudo easy_install MySQL_python-1.2.2-py2.5-win32.egg
# to remove:
sudo easy_install -m MySQL_python-1.2.2-py2.5-win32.egg
# and also remove the file from e.g. /usr/local/lib/python2.6/dist-packages
Tags: