Mysql

38
10 th planet technologies ArjunRaj.d Mysql INSTALL INSTALL UNINSTALL UNINSTALL SETUP SETUP CONFIGURE CONFIGURE BASIC SQL,ADVANCED SQL BASIC SQL,ADVANCED SQL

description

Relates to LAMP

Transcript of Mysql

Page 1: Mysql

10th planet technologiesArjunRaj.d

Mysql INSTALLINSTALL UNINSTALLUNINSTALL SETUPSETUP CONFIGURECONFIGURE BASIC SQL,ADVANCED SQLBASIC SQL,ADVANCED SQL

Page 2: Mysql

Installation

Step #1: Download MySQL 4.1.18

Download MySQL 4.1.18 (1 Jul 2005, 25.1MB)

Filename: mysql-essential-4.1.18-win32.msi

MD5 checksum: 40be516916b82b4b6af699ec3873917f (What's this?)

For archives of various MySQL versions

Page 3: Mysql

a:

Step #2: Install MySQL

Page 4: Mysql

b:

2.Select a setup type - Typical, Complete, Custom. Select Typical and click Next. The default insllation directory will be C:Programs FilesMySQLMySQL Server 4.1.MySQL version 4.1.18 installation setup type.

Page 5: Mysql

c:

3.Ready to install MySQL. After review the settings, click Install. If you want to change any settings, click [Back] button

Page 6: Mysql

d:

Installation in progress.

Page 7: Mysql

e:

5.MySQL.com Sign-Up. If you don't want to sign-up at this stage, select Skip Sign-up and click Next.

Page 8: Mysql

f:

6.Setup Wizard Completed. Make sure you have selected 'Configure the MySQL Server now' checkbox if you want to configure it after click Finish button.

Page 9: Mysql

Setup MYSQL

Mysql is a popular open source database which being used as database server by many organizations around the world

Mysql is used together with PHP server-side scripting language, Apache web server and Linux as the server platform

root@slackware:~# less /etc/passwd | grep mysql

mysql:x:27:27:MySQL:/var/lib/mysql:/bin/false

root@slackware:~#root@slackware:~# less /etc/group | grepmysqlmysql:x:27

Page 10: Mysql

a:

root@slackware:~# ls /var/run/ | grep mysql

mysql/

root@slackware:~#

Page 11: Mysql

b:

Create a new directory named mysql in /var/run directory if it's not there. Learn how to create new directory in Slackware in mkdir tutorial. When you are done, check mysql directory ownership. It must be owned by mysql user and mysql group.

root@slackware:~# ls -l /var/run/ | grep mysql

drwxr-xr-x 2 mysql mysql 4096 2008-10-05 13:29 mysql/

root@slackware:~#

Page 12: Mysql

c:

You can change directory ownership with Linux chown command. See the example below:

root@slackware:~# chown -R mysql.mysql /var/run/mysql/

root@slackware:~#

Page 13: Mysql

d:

Install or upgrade mysql package in your Slackware system. See example on how to install mysql using slackpkg command below:

root@slackware:~# slackpkg install mysql

Looking for mysql in package list. Please wait... DONE

No packages match the pattern for install. Try: /usr/sbin/slackpkg reinstall|upgrade

Page 14: Mysql

e:

If you see the same result as the example below, try running the command again but using slackpkg upgrade option instead. Don't worry of you see the same result again. You probably have mysql installed and upgrade to the latest version already. You can confirm it by checking the installed packages in log directory. See the example below:

root@slackware:~# ls -l /var/log/packages/ | grep mysql-rw-r--r-- 1 root root 8159 2009-02-28 01:25 mysql-5.0.67-i

Page 15: Mysql

Configure mysql

If you see the same result as the example below, try running the command again but using slackpkg upgrade option instead. Don't worry of you see the same result again. You probably have mysql installed and upgrade to the latest version already. You can confirm it by checking the installed packages in log directory. See the example below:

root@slackware:~# ls -l /var/log/packages/ | grep mysql-rw-r--r-- 1 root root 8159 2009-02-28 01:25 mysql-5.0.67-i

Page 16: Mysql

a:

root@slackware:~# usermod -G mysql mysql

root@slackware:~# id mysql

uid=27(mysql) gid=27(mysql) groups=27(mysql)

Page 17: Mysql

b:

create a new mysql configuration file called my.cnf

root@slackware:~# ls -l /etc/ | grep my

-rw-r--r-- 1 root root 4972 2008-10-05 13:29 my-huge.cnf

-rw-r--r-- 1 root root 4948 2008-10-05 13:29 my-large.cnf

-rw-r--r-- 1 root root 4955 2008-10-05 13:29 my-medium.cnf-rw-r--r-- 1 root root 2525 2008-10-05 13:29mysmall.cnfroot@slackware:~#root@slackware:~# cp /etc/mymedium.cnf/etc/my.cn

Page 18: Mysql

c:

Create mysql database

root@slackware:~# mysql_install_db --user=mysql

Installing MySQL system tables...

090423 12:35:45 [Warning] option 'max_join_size': unsigned value 18446744073709551615 adjusted to 4294967295

090423 12:35:45 [Warning] option 'max_join_size': unsigned value 18446744073709551615 adjusted to 4294967295

OK

Page 19: Mysql

d:

Filling help tables...

090423 12:35:45 [Warning] option 'max_join_size': unsigned value 18446744073709551615 adjusted to 4294967295

090423 12:35:45 [Warning] option 'max_join_size': unsigned value 18446744073709551615 adjusted to 4294967295

Page 20: Mysql

e:

To start mysqld at boot time you have to copy

support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !To do so, start the server, then issue the following commands:/usr/bin/mysqladmin -u root password 'new-password'

/usr/bin/mysqladmin -u root -h slackware password 'new-password'

Page 21: Mysql

f:

Alternatively you can run:

/usr/bin/mysql_secure_installation

which will also give you the option of removing the test

databases and anonymous user created by default. This is

strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:

Page 22: Mysql

g:

cd /usr ; /usr/bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl

cd mysql-test ; perl mysql-test-run.pl

Please report any problems with the /usr/bin/mysqlbug script!

Page 23: Mysql

g:

To start mysql daemon at boot time, we can change the mysqld script file permission, the /etc/rc.d/rc.mysqld.

root@slackware:~# chmod 755 /etc/rc.d/rc.mysqld

root@slackware:~# ls -l /etc/rc.d/ | grep mysqld

-rwxr-xr-x 1 root root 2585 2008-10-05 13:29 rc.mysqld*

Page 24: Mysql

h:

Create password for mysql root user:

root@slackware:~# /usr/bin/mysqladmin -u root password 'new_password'

/usr/bin/mysqladmin: connect to server at 'localhost' failederror: 'Can't connect to local MySQL server through socket '/var/run/mysql/mysql.sock' (2)'

Check that mysqld is running and that the socket: '/var/run/mysql/mysql.sock' exists!

Page 25: Mysql

i:

Opss...we got an error there. We forgot to start mysql daemon (mysql server) first. Let's start the server now:

root@slackware:~# /usr/bin/mysqld_safe &

Page 26: Mysql

k:

The tool is mysql_secure_installation. It's recommended you run this command

In order to log into MySQL to secure it, we'll need the current

password for the root user. If you've just installed MySQL, and

you haven't set the root password yet, the password will be blank,

so you should just press enter here.

Enter current password for root (enter for none):

Page 27: Mysql

Uninstall mysql and remove mysql data

Stop mysql service:

root@slackware:~# killall -9 mysqld mysqld_safe[1]+ Killed /usr/bin/mysqld_saferoot@slackware:~#

Uninstall mysql using slackpkg:

root@slackware:~# slackpkg remove mysql

Remove remaining mysql data and directory.root@slackware:~# rm-r/var/lib/mysql/root@slackware:~# rm /etc/my.cnf

Page 28: Mysql

Advanced Sql

DB2ASP DB2ASP converts and publishes your database to

dynamic asp web pages. DB2ASP creates ASP, HTML, CSS, and JavaScript in minutes, saving hours or even days of work. You can view/add/edit/delete you data via any browser. DB2ASP is for non-programmers an..

Page 29: Mysql

a:* SQL UNION* SQL UNION ALL* SQL

INTERSECT* SQL MINUS

* SQL LIMIT* SQL TOP * SQL Subquery * SQL EXISTS * SQL CASE

# SQL NULL

# SQL ISNULL Function

# SQL IFNULL Function

# SQL NVL Function

# SQL Coalesce Function

# SQL NULLIF Function

Page 30: Mysql

b:

* Rank * Median * Running Totals * Percent To Total * Cumulative Percent To Total

Page 31: Mysql

Configure My sql

Start MySQL Server Instance Configuration Wizard.

Page 32: Mysql

2.Select configuration type. Because you do not already have another MySQL server installed, choose Standard Configuration.

Page 33: Mysql
Page 34: Mysql

4.Set a new password to root account. When MySQL was installed, the password for root account was blank. Now it is time to set a new password to it. Don't select the Create An Anonymous Account checkbox. This can lead to an insecure system.

Set a new password to MySQL Server root account.

Page 35: Mysql
Page 36: Mysql

5.Now everything is ready to execute. Click Execute button to run it.

Page 37: Mysql

6.MySQL server configuration completed successfully.

Page 38: Mysql

Thank U