Showing posts with label mysql. Show all posts
Showing posts with label mysql. Show all posts

Tuesday, April 12, 2011

Apache MySQL PHP on Mac OS X Snow Leopard

In Mac OS X, you already have built-in Apache web server and you only need to activate it by going to System Preferences -> Sharing -> then check the "Web Sharing". That's it! And you already have your web server running. Just check it by typing "http://localhost" or "http://localhost/~yourusername" in your web browser.

PHP
After that, you can open Terminal and open /private/etc/apache2/httpd.conf file and uncomment this line:
LoadModule php5_module           libexec/apache2/libphp5.so
 then restart Apache service by uncheck - recheck Web Sharing in System Preferences

MySQL
1. Download package from here
2. Install everything: mysql, startup item, preference pane
3. Start MySQL in Preference Pane

Do the following to fix some stuffs:
$ cd /etc
$ sudo cp php.ini.default php.ini
$ sudo chmod 666 php.ini
In php.ini file, edit following:
1. uncomment this line and insert TimeZone:
date.timezone =Asia/Jakarta
2. find all three occurences of /var/mysql/mysql.sock and change to /tmp/mysql.sock
pdo_mysql.default_socket = /tmp/mysql.sock
mysql.default_socket = /tmp/mysql.sock
mysqli.default_socket = /tmp/mysql.sock
3. change this line from "Off" to "On"
short_open_tag = On
Restart Apache service by uncheck - recheck Web Sharing in System Preferences

Monday, May 24, 2010

cPanel Configuration for MySQL Access

Case: cPanel user would like to hire web developer, want to give ftp access (for upload and download web files) and MySQL database access (the web is using Joomla) only.

These are the example:
- db name: cybi1_testing
- db username: cybi1_test
- pass: t3st1ng
- host: cybi.co.id (server Cohosting 1)

a. via terminal:



b. or via phpMyAdmin (available for Linux/ Unix, Windows and Mac/ other mySQL FrontEnd GUI:




Below are the steps to follow:
1. Create ftp account for the web developer, menu Files → FTP Accounts



Fill-in username, password, default directory dan capacity




2. Create new database, user and priviliges to access the database







3. Allowing host to access database, Databases → Remote MySQL




Enjoy.. :)

Saturday, April 17, 2010

Resetting MySQL Root Password

This is what you can do to resetting your mysql root access in case you're forget it. I just copy and paste it from mysql official website. Use it wisely, guys :)

On any platform, you can set the new password using the mysql client (but this approach is less secure):
  1. Stop mysqld and restart it with the --skip-grant-tables option.
  2. Connect to the mysqld server with this command:

    shell> mysql
  3. Issue the following statements in the mysql client. Replace the password with the password that you want to use.

    mysql> UPDATE mysql.user SET Password=PASSWORD('MyNewPass')
        ->                   WHERE User='root';
    mysql> FLUSH PRIVILEGES;
You should now be able to connect to MySQL as root using the new password.

Thursday, April 15, 2010

Building Cacti on Ubuntu Server 8.04 Hardy Heron



Although it seems difficult, after several trial and error on my Ubuntu Server 8.04 finally I can get my Cacti up and running :) I copy-paste from Cacti website installation document and editing several lines to suite Ubuntu. First of all, you need to install from repositories (including all dependencies):
- apache2
- php5
- php5-cli
- rrdtool
- snmp
- cacti sourse file from here, choose the latest version

Configure PHP
Please find the file /etc/php5/apache2/php.ini and make the following changes to it:
extension_dir = /etc/php.d
This will enable PHP to find more configuration directives in that very directory.


If you want to allow template importing, uncomment the following line:

file_uploads = On
 Activate the MySQL extension via /etc/php5/conf.d/mysql.ini
; Enable mysql extension module
extension=mysql.so
Activate the SNMP extension via /etc/php5/conf.d/mysql.ini
; Enable snmp extension module
extension=snmp.so

Configure the Webserver (Apache)
Please locate the PHP configuration file at /etc/apache2/httpd.conf
If using PHP 5, then add the following lines.
# PHP is an HTML-embedded scripting language which attempts to make it
# easy for developers to write dynamically generated webpages.
LoadModule php5_module modules/libphp5.so
#
# Cause the PHP interpreter to handle files with a .php extension.
AddHandler php5-script .php
AddType text/html .php
#
# Add index.php to the list of files that will be served as directory
# indexes.
DirectoryIndex index.php
Configure MySQL
Set a password for the root user
# mysqladmin --user=root password somepassword
# mysqladmin --user=root --password reload

Install and Configure Cacti
1. Extract the distribution tarball
# tar xzvf cacti-version.tar.gz

2. Create the MySQL database:
# mysqladmin --user=root create cacti

3. Import the default cacti database:

# mysql cacti < /path/to/cacti/cacti.sql

4. Optional: Create a MySQL username and password for Cacti.
# mysql --user=root mysql
mysql> GRANT ALL ON cacti.* TO cactiuser@localhost IDENTIFIED BY 'somepassword';
mysql> flush privileges;

Edit /path/to/cacti/include/config.php and specify the database type, name, host, user and password for your Cacti configuration.
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cactiuser";
$database_password = "cacti";

Set the appropriate permissions on cacti's directories for graph/log generation. You should execute these commands from inside cacti's directory to change the permissions.
# chown -R cactiuser rra/ log/

(Enter a valid username for cactiuser, this user will also be used in the next step for data gathering)

Point your web browser to:

http://your-server/cacti/

Log in the with a username/password of admin
. You will be required to change this password immediately. Make sure to fill in all of the path variables carefully and correctly on the following screen.

For Ubuntu Distro, I have found that crontab setting is a bit different. You must edit /etc/cron.d/cacti files in order the cron to be running (Usually we used crontab -e in any linux/unix to add cron job)

$ cat /etc/cron.d/cacti
MAILTO=
*/5 * * * * root php /var/www/cacti/poller.php > /dev/null 2>&1 /var/log/cacti/poller-error.log


Saturday, April 3, 2010

Interlude Of The Life

There's been an empty post for several month, it is due to many circumstances. One of them is that I decide to do so.. not write or post anything in my blog. But now it's time to start again. There's a lot to write. So, if you haven't read anything in my blog, start to do it.. or there would be a lot to catch :)

Thursday, October 22, 2009

Installing Zenoss on Ubuntu Jaunty 9.04 Server Edition

Zenoss is open source network infrastructure software. Here is how I installed it on my Ubuntu Jaunty 9.04 Server Edition. First, make sure you do the following:

# sudo apt-get install build-essential autoconf swig
# sudo apt-get install libmysqlclients15-dev
# sudo apt-get install python-dev


# sudo vi /etc/apt/sources.list
  • ## zenoss-ubuntu
  • deb http://dev.zenoss.org/deb main stable
# sudo apt-get update
# sudo apt-get install zenoss-stack
# sudo /etc/init.d/zenoss-stack start

After the setting-up is done, you can access 1st time setup wizard by pointing your web browser url to http://localhost:8080

Exporting and Importing MySQL Database

1. Export
# mysqldump -u [username] -p [database-name] > [database-name].sql
2. Import
# mysqladmin -u [username] -p create [database-name]
# mysql [database-name] < [database-name].sql