Never been to TextSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

About this user

Michael Baumgarten http://www.minofare.com

« Newer Snippets
Older Snippets »
9 total  XML / RSS feed 

Manually Starting & Stopping MySQL in Leopard

This is for software built from source according to:
http://hivelogic.com/articles/installing-mysql-on-mac-os-x/

Start MySQL
sudo launchctl unload -w /Library/LaunchDaemons/com.mysql.mysqld.plist


Stop MySQL
sudo launchctl load -w /Library/LaunchDaemons/com.mysql.mysqld.plist


MySQL 5 macports setup

You have to symlink mysql to the location on osx

first find out where mysql has put the socket:
mysql_config5 --socket

Next symlink /tmp/mysql.sock to the right location of the socket
sudo ln -s path-of-mysql.sock-from-above /tmp/mysql.sock


Start MySQL
sudo /opt/local/share/mysql5/mysql/mysql.server start

or
/opt/local/bin/mysqld_safe5


Stop MySQL
sudo /opt/local/share/mysql5/mysql/mysql.server stop

Setup LAMP on Ubuntu with MyODBC support.

Go to terminal:

sudo apt-get install apache2 mysql-server php5 php5-odbc libapache2-mod-php5 php5-xsl php5-gd php-pear libapache2-mod-auth-mysql php5-mysql libmyodbc


Now hand edit (or create, if it does not exist already) /etc/odbc.ini

Here's an example odbc.ini:

[ODBC Data Sources]
odbcname     = MyODBC 3.51 Driver DSN

[odbcname]
Driver       = /usr/lib/odbc/libmyodbc.so
Description  = MyODBC 3.51 Driver DSN
SERVER       = my.database.server.com
PORT         =
USER         = USER
Password     = XXXXXX
Database     = DBNAME
OPTION       = 3
SOCKET       =

[Default]
Driver       = /usr/local/lib/libmyodbc3.so
Description  = MyODBC 3.51 Driver DSN
SERVER       = localhost
PORT         =
USER         = root
Password     =
Database     = test
OPTION       = 3
SOCKET       =


Remember to start and stop mysql and apache:

sudo /etc/init.d/mysql start
sudo /etc/init.d/apache2 start

sudo /etc/init.d/mysql stop
sudo /etc/init.d/apache2 stop
sudo /etc/init.d/mysql restart
sudo /etc/init.d/apache2 restart

Give remote access to mysql

mysql -u root -p (your password)


then write the following

GRANT ALL PRIVILEGES ON *.* TO user@'%' IDENTIFIED BY 'PASSWORD';


then

FLUSH PRIVILEGES;

Remove Existing MySQL Installations

If you already have MySQL installed and used the package installer from MySQL to install it, you need to remove a single file (actually a symlink) to disable it:

sudo rm /usr/local/mysql


If you also installed the StartupItem package, you’ll want to remove it as well. Keep in mind that if you ever want to auto-start the old version of MySQL later on, you’ll need to re-download the package installer and reinstall the StartupItem.

sudo rm -rf /Library/StartupItems/MySQLCOM/

Change Root user password



mysql -h localhost -u root
mysql> USE mysql;
mysql> UPDATE user SET Password=PASSWORD('root-pwd') WHERE user='root';
mysql> FLUSH PRIVILEGES;
mysql> EXIT

MySQL add user

mysql> GRANT ALL PRIVILEGES ON *.* TO 'user'@'localhost'
    ->     IDENTIFIED BY 'some_pass' WITH GRANT OPTION;

Macports MySQL 5 startup on launch

A startup item has been generated that will aid in starting mysql5 with launchd. It is disabled by default. Execute the following command to start it, and to cause it to launch at startup:
sudo launchctl load -w /Library/LaunchDaemons/org.macports.mysql5.plist


Starting and stopping MySQL on leopard.

#starting SQL:
sudo /usr/local/mysql/support-files/mysql.server start

Stoping SQL:
sudo /usr/local/mysql/support-files/mysql.server stop
« Newer Snippets
Older Snippets »
9 total  XML / RSS feed