Showing posts with label MySQL. Show all posts
Showing posts with label MySQL. Show all posts

Features of MySQL Database Server


MySQL is a relational database management system.
Whether you’re involved with a Web site that processes millions
of requests a day like eBay or Yahoo!, or a smaller site
such as your own online shop or training course, the data must
be stored in an organized and structured way for easy access
 and processing. This is handled by a database management
system such as MySQL where the data is stored in tables
rather than in a flat file.

MySQL uses the client/server model; that is, a database server
 MySQL that serves communicates with multiple clients
application programs, where the clients may or may not be on
 the same computer. It also supports SQL, the
structured query language, a standardized language used by
most modern databases for working with data and
administering the database.

 The MySQL software
uses the GPL -GNU General Public License,
http://www.fsf.org/licenses/, to define what you may and may not do with
the software in different situations. If you need to use MySQL
code in a commercial application, you can buy a commercially
licensed version. See the MySQL Licensing Overview for
more information
http://www.mysql.com/company/legal/licensing  .


The MySQL Database Server is very fast, reliable, and easy
 to use. MySQL Server was originally developed to handle
large databases much faster than existing solutions and has
been successfully used in highly demanding production
environments for several years. Its connectivity, speed, and
 security make MySQL Server highly suited for accessing
databases on the Internet.

MySQL serves as a back end for all kinds of information
such as e-mail, Web images and content, games, log files, and
so on. The server can be embedded in applications such as
cell phones, electronic devices, public kiosks, and more.

 Most Popular Posts

http://seo-tips-tech.blogspot.com/2013/09/list-of-100-top-best-social-bookmarking.html
http://seo-tips-tech.blogspot.com/2013/09/list-of-top-200-best-free-classifieds.html
http://seo-tips-tech.blogspot.com/2013/09/marketing-your-site-and-track-visitors.html
http://seo-tips-tech.blogspot.com/2013/09/maximum-performance-from-mysql.html
http://seo-tips-tech.blogspot.com/2013/09/php-best-top-20-open-source-content.html
http://seo-tips-tech.blogspot.com/2013/09/php-implode-array-elements.html
http://seo-tips-tech.blogspot.com/2013/09/php-mail-functions.html
http://seo-tips-tech.blogspot.com/2013/09/php-mvc-tutorial-for-beginners-model.html
http://seo-tips-tech.blogspot.com/2013/09/php-renaming-files-and-directories.html
http://seo-tips-tech.blogspot.com/2013/09/php-sessions-page.html
http://seo-tips-tech.blogspot.com/2013/09/php-urlencode-make-strong-get-query.html
http://seo-tips-tech.blogspot.com/2013/09/php-use-header-function-php.html
http://seo-tips-tech.blogspot.com/2013/09/select-great-website-domain-name.html
http://seo-tips-tech.blogspot.com/2013/09/sql-inherently.html
http://seo-tips-tech.blogspot.com/2013/09/technical-internet-marketing.html
http://seo-tips-tech.blogspot.com/2013/09/test-web-site-in-other-browsers-online.html
http://seo-tips-tech.blogspot.com/2013/09/tips-inbound-marketing-tactics.html
http://seo-tips-tech.blogspot.com/2013/09/tips-to-ranking-high-on-yelp.html
http://seo-tips-tech.blogspot.com/2013/09/top-20-best-free-email-service.html
http://seo-tips-tech.blogspot.com/2013/09/top-20-best-social-networking-sites.html
http://seo-tips-tech.blogspot.com/2013/09/top-20-free-website-templates-download.html
http://seo-tips-tech.blogspot.com/2013/09/top-50-best-and-top-rank-forum-sites.html
http://seo-tips-tech.blogspot.com/2013/09/top-50-most-popular-best-sites-for.html
http://seo-tips-tech.blogspot.com/2013/09/top-emarketing-tip.html
http://seo-tips-tech.blogspot.com/2013/09/video-search-optimizing-tips.html
http://seo-tips-tech.blogspot.com/2013/09/ways-to-make-money-at-home-fast.html
http://seo-tips-tech.blogspot.com/2013/09/web-seo-tip-for-image-picasa-photo-feed.html
http://seo-tips-tech.blogspot.com/2013/10/
http://seo-tips-tech.blogspot.com/2013/10/3d-wallpaper.html
http://seo-tips-tech.blogspot.com/2013/10/accounting-job-india.html
http://seo-tips-tech.blogspot.com/2013/10/bank-job-india.html
http://seo-tips-tech.blogspot.com/2013/10/content-marketing-of-small-business.html
http://seo-tips-tech.blogspot.com/2013/10/database-software.html
http://seo-tips-tech.blogspot.com/2013/10/db-jobs-database-job-dba.html
http://seo-tips-tech.blogspot.com/2013/10/government-jobs-list-india.html
http://seo-tips-tech.blogspot.com/2013/10/human-resources-job-hr-job-india.html
http://seo-tips-tech.blogspot.com/2013/10/job-finder.html
http://seo-tips-tech.blogspot.com/2013/10/mobile-computing.html
http://seo-tips-tech.blogspot.com/2013/10/most-popular-technology-tags.html
http://seo-tips-tech.blogspot.com/2013/10/offline-marketing-tips.html
http://seo-tips-tech.blogspot.com/2013/10/personalisation-of-ecommerce.html
http://seo-tips-tech.blogspot.com/2013/10/php-developer-jobs.html
http://seo-tips-tech.blogspot.com/2013/10/php-job-in-kolkata.html
http://seo-tips-tech.blogspot.com/2013/10/php-jobs-india.html
http://seo-tips-tech.blogspot.com/2013/10/seo-job.html
http://seo-tips-tech.blogspot.com/2013/10/seo-jobs-in-kolkata.html
http://seo-tips-tech.blogspot.com/2013/10/seo-marketing-news.html
http://seo-tips-tech.blogspot.com/2013/10/seo-marketing-plan.html
http://seo-tips-tech.blogspot.com/2013/10/seo-marketing-term.html
http://seo-tips-tech.blogspot.com/2013/10/seo-marketing-youtube.html
http://seo-tips-tech.blogspot.com/2013/10/top-5-video-sharing-sites.html
http://seo-tips-tech.blogspot.com/2013/10/top-blog-tips.html
http://seo-tips-tech.blogspot.com/2013/10/top-ranking-with-yahoo.html

MySQL with php

The basic steps of performing a query, whether using the mysql
command-line tool or PHP, are the same:

Connect to the database.

Select the database to use.

Build a SELECT statement.

Perform the query.

Display the results.



When connecting to a MySQL database, you will use two
 new resources. The first is the link identifier that holds all
of the information necessary to connect to the database for
an active connection. The other resource is the results resource.
It contains all information required to retrieve results from an
active database query's result set.


<?php
$db_host='hostname of database server';
$db_database='database name';
$db_username='username';
$db_password='password';

$connection = mysql_connect($db_host, $db_username, $db_password);
if (!$connection){
die ("Could not connect to the database: <br />". mysql_error());
}

$db_select = mysql_select_db($db_database);
?>

Building a SQL query is as easy as setting a variable to the
string that is your SQL query. Of course, you'll need to use a
valid SQL query, or MySQL returns with an error when you
execute the query. The variable name $query is used, but you
can choose anything you'd like for a variable name.
The SQL query in this example is
SELECT * FROM tbl.




Advantages of MySQL and PHP

Certain technologies play together better than others. PHP, a simple and powerful scripting language, and MySQL, a solid and reliable database server, make a perfect marriage between two modern technologies for building databasedriven, dynamic Web sites. Some of the advantages of both PHP and MySQL are:
•  High performance
•  Built-in libraries
•  Extensibility
•  Relatively low cost
•  Portability
•  Developer community
•  Ease of learning
High Performance
PHP is no longer considered just a grassroots scripting language, but now with PHP 5, and its highly efficient built-in Zend engine, PHP accommodates developers and IT decision makers in the business trend to rapidly release and update software on the Web faster than conventional programming cycles have allowed.
MySQL, a highly optimized database server, provides the response time and throughput to meet the most demanding applications.With PHP scripts connected to a MySQL database, millions of pages can be served on a single inexpensive server.
Built-In Libraries
PHP comes with many built-in functions addressing common Web development tasks. Problems encountered by other programmers have been solved and packaged into a library of routines, made available to the PHP community. The official PHP Web site at http://www.php.netprovides excellent documentation explaining how to use all of the functions currently available.
Extensibility
PHP and MySQL are both extensible, meaning that developers around the world are contributing add-on modules to extend the functionality and power of the languages to stay current with the growing market needs and standards of the day. You can also obtain the source code for both PHP and MySQL. Source code is the code that a program consists of before theprogram is compiled; that is, the original building instructions of a program.
Relatively Low Cost
As a Web developer you can demand a lot more money for your time if you can master PHP and MySQL. Because they are open source projects, there is no licensefee associated with using PHP or MySQL. Because both applications run on almost any platform, you also have a wide range of hardware choices lowering the total cost of ownership. With so many qualified PHP developers sharing information on the Web, and excellent online documentation, you can get the most up-to-date, reliable information without paying for it.
Portability
PHP and MySQL run on almost any platform, including Linux, Windows, Mac OS X, FreeBSD, Solaris, and so on. If well written, you can simply copy the code from one server to another and expect the same results, perhaps with some minor adjustments.
Developer Community
Both PHP and MySQL have a huge following in the development community. If you run into a problem, you can usually very quickly find support on the Web, where your problem can be posted, identified, and resolved by other users and developers sharing your problem. Developers worldwide are constantly finding and resolving bugs and security holes, while working to keep these languagesup-to-date and optimized.
Ease of Learning
PHP and MySQL are relatively easy to learn. Most of the PHP constructs are similar to other languages, specifically Perl, making it familiar to most developers. MySQL uses the SQL query language and English-like language used by most modern database management systems today. If you have had any experience with SQL, you will find using it with MySQL an easy transition.

MySQL is a relational database management system. Whether you’re involved with a Web site that processes millions of requests a day like eBay or Yahoo!, or a smaller site such as your own online shop or training course, the data must be stored in an organized and structured way for easy access and processing.
This is handled by a database management system such as MySQL where the data is stored in tables rather than in a flat file.

MySQL uses the client/server model; that is, a database server (MySQL) that serves (communicates) with multiple clients application programs), where the clients may or may not be on the same computer. It also supports SQL, the structured query language, a standardized language used by most modern databases for working with data and administering the database.

MySQL software is open source. As discussed earlierin this chapter, open source means that it is possible for anyone to download MySQL from the Internet, and use and modify the software without paying anything. The MySQL software uses the GPL GNU General Public License, http://www.fsf.org/licenses/, to define what you may and may not do with the software in different situations. If you need to use MySQL code in a commercial application, you can buy a commercially licensed version. See the MySQL Licensing Overview for more information http://www.mysql.com/company/legal/licensing .
The MySQL Database Server is very fast, reliable, and easy to use. MySQL Server was originally developed to handle large databases much faster than existing solutions and has been successfully used in highly demanding production environments for several years. Its connectivity, speed, and security make MySQL Server highly suited for accessing databases on the Internet.

MySQL serves as a back end for all kinds of information such as e-mail, Web images and content, games, log files, and so on. The server can be embedded in applications such as cell phones, electronic devices, public kiosks, and more.

top Database management system-PHP

This summary is not available. Please click here to view the post.

Web and Database Port Listing


Table A-1. HTTP/1.1 Methods and Field Definitions Web and Database Port Listing
Port
Server
66
Oracle SQL*Net
80
Hyper Text Transfer Protocol (HTTP)
81
HTTP Proxy, Alternative HTTP Port, Cobalt Server Administration Port
443
Secure Socket Layer (SSL)
445
Microsoft SQL Server over NetBIOS
457
UnixWare/Netscape FastTrack Server
1080
SOCKS Proxy
1100
Oracle WebCache Listener
1241
KaZaA File Sharing Server (HTTP-like protocol)
1352
Lotus Domino (Notes)
1433
Microsoft SQL Server 2000
1434
Microsoft SQL Server over TCP/IP Redirector
1521–1530
Oracle
1944
Microsoft SQL Server 7
2301
Compaq Insight Manager, Compaq Survey Utility
3128
HTTP Proxy (Squid, NetCache, etc.)
3306
mySQL
4000
Oracle WebCache Listener
4001
Oracle WebCache Listener
4002
Oracle WebCache Listener
4100
Sybase 11.0 (jConnect)
5000
Sybase 12.x
5432
PostgreSQL
5800
VNC HTTP Console Port #1
5801
VNC HTTP Console Port #2
5802
VNC HTTP Console Port #3
6346
Gnutella (HTTP-like protocol)
6347
Gnutella (HTTP-like protocol)
7001
BEA WebLogic
7002
BEA WebLogic
8000
HTTP Proxy, Alternative HTTP Port, HP Web JetAdmin Version 6.0
8001
BEA WebLogic
Port
Server
8005
Apache Tomcat Administration Server (non-HTTP protocol)
8080
HTTP Proxy, Alternative HTTP Port
8888
HTTP Proxy, Alternative HTTP Port
30821
Netscape Enterprise Server Administration Server


Adding New User Privileges to MySQL

You can add users two di erent ways: by using GRANT statements or by manipulating the
MySQL grant tables directly. The preferred method is to use GRANT statements, because
they are more concise and less error-prone.

The examples below show how to use the mysql client to set up new users. These examples
assume that privileges are set up according to the defaults described in the previous section.
This means that to make changes, you must be on the same machine where mysqld is
running, you must connect as the MySQL root user, and the root user must have the
insert privilege for the mysql database and the reload administrative privilege. Also, if you
have changed the root user password, you must specify it for the mysql commands below.
You can add new users by issuing GRANT statements:

shell> mysql --user=root mysql
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;
mysql> GRANT RELOAD,PROCESS ON *.* TO admin@localhost;
mysql> GRANT USAGE ON *.* TO dummy@localhost;
These GRANT statements set up three new users:

monty A full superuser who can connect to the server from anywhere, but who must use
a password 'some_pass' to do so. Note that we must issue GRANT statements
for both monty@localhost and monty@"%". If we don't add the entry with
localhost, the anonymous user entry for localhost that is created by mysql_
install_db will take precedence when we connect from the local host, because
it has a more speci c Host eld value and thus comes earlier in the user table
sort order.
admin A user who can connect from localhost without a password and who is granted
the reload and process administrative privileges. This allows the user to execute the mysqladmin reload, mysqladmin refresh, and mysqladmin flush-*
commands, as well as mysqladmin processlist .
No database-related privileges are granted. They can be granted later by issuing additional GRANT
statements.

dummy A user who can connect without a password, but only from the local host. The
global privileges are all set to 'N' | the USAGE privilege type allows you to
create a user with no privileges. It is assumed that you will grant databasespeci c privileges later.
You can also add the same user access information directly by issuing INSERT statements
and then telling the server to reload the grant tables

why need For a relational database?

A database or database management system that stores information in tables—rows and columns of data—and conducts searches by using data in specified columns of one table to find additional data in another table. In a relational database, the rows of a table represent records (collections of information about separate items) and the columns represent fields (particular attributes of a record). In conducting searches, a relational database matches information from a field in one table with information in a corresponding field of another table to produce a third table that combines requested data from both tables. 


For example, if one table contains the fields EMPLOYEE-ID, LAST-NAME, FIRST-NAME, and HIRE-DATE, and another contains the fields DEPT, EMPLOYEE-ID, and SALARY, a relational database can match the EMPLOYEE-ID fields in the two tables to find such information as the names of all employees earning a certain salary or the departments of all employees hired after a certain date. In other words, a relational database uses matching values in two tables to relate information in one to information in the other. Microcomputer database products typically are relational databases. Compare flat-file database, inverted-list database.

Relational Databases-MySQL

MySQL is a relational database. An important feature of relational systems is that a single database can be spread across several tables as opposed to our flat-file phone book example. Related data is stored in separate tables and allows you to put them together by using a key common to both tables. The key is the relation between the tables. The selection of a primary key is one of the most critical decisions you'll make in designing a new database. The most important concept that you need to understand is that you must ensure the selected key is unique. If it's possible that two records past, present, or future share the same value for an attribute, don't use them as a primary key. Including key fields from another table to form a link between tables is called a foreign key relationship, like a boss to employees or a user to a purchase. The relational model is very useful because data is retrieved easier and faster.

Relationship Types

Databases relationships are quantified with the following categories:
  • One-to-one relationships
  • One-to-many relationships
  • Many-to-many relationships
We'll discuss each of these relationships and provide an example. If you think of a family structure when thinking about relationships, you're ahead of the game. When you spend time alone with one parent, that's a specific type of relationship; when you spend time with both your parents, that's another one. If you bring in a significant partner and all of youyour parents, you, and your partnerall do something together, that's another relationship. This is identical to the bucket analogy. All those different types of relationships are like specific buckets that hold the dynamics of your relationships. In the database world, it's the data you've created.

In a one-to-one relationship, each item is related to one and only one other item. Within the example of a bookstore. A one-to-one relationship exists between users and their shipping addresses.

Normalization

Thinking about how your data is related and the most efficient way to organize it is called normalization. Normalization of data is breaking it apart based on the logical relationships to minimize the duplication of data. Generally, duplicated data wastes space and makes maintenance a problem. Should you change information that is duplicated, there's the risk that you miss a portion and you risk inconsistencies in you database.
It's possible to have too much of a good thing though: databases placing each piece of data in their own tables would take too much processing time and queries would be convoluted. Finding a balance in between is the goal.
While the phone book example is very simple, the type of data that you process with a web page can benefit greatly from logically grouping related data.
Let's continue with the bookstore example. The site needs to keep track of the user's data, including login, address, and phone number, as well as information about the books, including the title, author, number of pages, and when each title was purchased.

Backing Up and Restoring Data MySQL

Even the best maintained databases occasionally develop problems. Hardware failures, in particular, can really throw a monkey wrench into your web pages. Now that you're using a database, just backing up the files (HTML, PHP, and images) on your web server isn't enough. There's nothing worse than informing your web users that they have to reenter information, such as their accounts, or have to recreate your catalog items. Having a complete backup can make the difference between an hour of down time and having to recreate the wheel. There are a couple of tactics that we'll discuss for backing up your database data.

Copying Database Files

You can also do a simple file backup of your MySQL database's datafiles, in the same way that you can back up your HTML and PHP files. If you can back up files, you can back up the MySQL database files.
We don't recommend this tactic for moving a database from one machine to another server, since different versions of MySQL may expect these files to be in a different format. MySQL stores its datafiles in a special data directory that is usually located in C:\Program Files\MySQL\MySQL Server 4.1\data\[database_name] on Windows and in /var/lib/mysql on Unix variants such as Linux and Mac OS X.
To fully back up and restore a MySQL database using your current datafiles, all the files must be replaced in the same directory from which they were backed up. Then, the database must be restarted.

The mysqldump Command


It's better to use the MySQL command-line tool for making complete database backups. The same tools you'll use to back up and restore can also be used to change platforms or move your database from one server to another; mysqldump creates a text file containing the SQL statements required to rebuild the database objects and insert the data. The mysqldump command is accessible from the command line and takes parameters for backing up a single table, a single database, or everything. The command's syntax is:
mysqldump -u user -p objects_to_backup

The default mode for mysqldump is to export to backup and then to standard output, which is usually the screen.

Backing up
We're going to show you the commands to back up a database called test from the shell prompt.
mysqldump -u root -p test > my_backup.sql

This tells mysqldump to log into the database as the root user with a password of barney, and to back up the test database. The output of the command is saved to a file called my_backup.sql with the help of the redirect character also known as the greater-than symbol >.

To back up only a single table from a database, simply add the table name after the database name. For example, the command below illustrates how to back up only the authors table:
$ mysqldump -u root -p test authors > authors.sql

Most of the time, you'll just want to back up everything in the database. To do this, use the --all-databases command-line switch. The resulting database backup file will contain the commands necessary to create the databases and users, making a complete database restore a snap. Here's how to use this parameter:
$ mysqldump -u root -p --all-databases > my_backup.sql

To create an empty copy of your databasejust the structurefor testing, use the --no-data switch:
$ mysqldump -u root -p --no-data test > structure.sql

You can also do the opposite and just back up the data with the --no-create-info switch like this:
$ mysqldump -u root -p --no-create-info test > data.sql

Of course, having a backup of your database doesn't do you much good if you don't know how to restore the database from it.


Depending on how critical your data is and how often it changes, you can determine how often to back it up. As a rule, weekly, bi-weekly, and monthly are the most common schedules. If your business is completely dependent on your database, you should do a weekly backup schedule, if not backing up daily. Also, keeping a copy of the data in a separate location is a good idea in the event of large scale disasters, such as a fire. A client of ours keeps bi-monthly backups in a fire safe at the office, whereas another client sends the data to a backup service. A backup service can use physical hard drives, tapes, or CDs, or can log into your server and perform the backup electronically.





PHP Functions
Php tutorial - imagemagick
php.ini Basics
PHP Sessions
Cookies Versus Sessions
PHP Web-Related Variables
PHP ERRORS
maximum size of a file uploaded
Php Image upload
php file_get_contents
MySQL Data on the Web
What are GET and POST
php and pdf
$_ENV and $_SERVER
PEAR with php
SELECTING DATA PHP
prevent hijacking with PHP
LAMP
PHP MySQL Functions
PHP Zip File Functions
Substrings PHP
PHP Variable names
PHP magic methods
How to get current session id
Add variables into a session
$_GET , $_POST,$_COOKIE
different tables present in mysql
PHP CURL
php Sessions page
PHP-sorting an array
PHP-count the elements of array
Operators for If/Else Statements
PHP file uploading code
PHP global variables
Testing working using phpinfo
PHP Code for a Valid Number
PHP-Associative Arrays
PHP mvc tutorial
PHP get_meta_tags-Extracts
difference between print and echo
PHP best tutorial-PHP variables
Reading DOC file in PHP
PHP interview questions
convert time PHP
PHP implode array elements
header function-PHP
PHP-Renaming Files Directories
PHP Classes
in_array function in PHP
keep your session secure PHP
Web Application with PHP
What is SQL Injection
PHP-extract part of a string
PHP urlencode
PHP- know browser properties
PHP- Extracting Substrings
Checking Variable Values /Types
PHP-best 20 Open Source cms
IP AddressPHP
PHP-Scope Resolution Operator
how create new instance of object
how eliminate an object
PHP- ob_start
XML file using the DOM API
PHP- MVC
PHP- CAPTCHA
PHP- Position of a Value in an Array
PHP-Mail Functions
PHP-difference include vs require
calculate the sum of values in an array
PHP-total number of rows
Show unique records mysql
MySQL Triggers
MySQL data directory
MySQL Subqueries
PHP- Networking Functions
PHP- Operators
Restore database
Conditional Functions mysql
PHP-function overloading
Friend function
mysql_connect /mysql_pconnect
PHP-Error Control Operators
what is IMAP
Apache-Specific Functions
Send Email from a PHP Script
SQL inherently
WAMP, MAMP, LAMP
Php tutorial-SYMBOLS
Table Types-MySQL
PHP-Encryption data management
PHP Array
Running MySQL on Windows
Maximum Performance MySQL
XML-RPC
PHP-static variables
Advanced Database Techniques
FTP
Codeigniter
Apache Pool Size
Why NoSQL
MySQL Server Performance
Database software
SQL Interview Answers
PHP Redirect
PHP Interview Questions with Answers
Advanced PHP

Managing the Database

Creating Users

To create users above and beyond the default privileged root user, issue the grant command. The grant command uses this syntax:
GRANT PRIVILEGES ON DATABASE.OBJECTS TO'USER'@'HOST' IDENTIFIED BY 'PASSWORD';

For example:
GRANT ALL PRIVILEGES ON *.* TO 'michele'@'localhost' IDENTIFIED BY 'secret';

This creates the user michele who can access anything locally. To change to the michele user, at the mysql command prompt, type:
exit

Then start MySQL from the command line with the new username and password. The syntax for specifying the username and password when starting MySQL is:
mysql -h hostname -u username -ppassword

If you don't want users to access tables other than their own, replace * with the name of the user's database, like this:
GRANT ALL PRIVILEGES ON `store`.* TO 'michele'@'localhost' IDENTIFIED BY 'secret';

You'll need to run the above line as root or as someone with permission. In the above code, the word store correlates to the database name to which privileges are assigned, which you'll create in the next section.

8.2.2. Creating a MySQL Database

You're going to create a database called store. The create database command works like this:
CREATE DATABASE `store`;

If this works, you'll get a result like this one:
Query OK, 1 row affected 0.03 sec
 
 
To start using this database, type:
USE `store`;
You will get the result:
Database changed.
Assuming you've done everything correctly, you'll be set up with new data and selected it for use. Creating tables is an important concept, so that's where we're headed!.


To rename a table, use ALTER TABLE table RENAME newtable. In this example, we are renaming the table from books to publications.
ALTER TABLE `books` RENAME `publications`;

 

Why MySQL Database?

MySQL has its own client interface, allowing you to move data around and change database configuration. Note that you must use a password to log in. Assigning database users allows you to limit access to server tables that have multiple users. Each MySQL server, where tables are grouped together, can host many databases. Normally, a web application has its own proprietary database.
You may have installed MySQL yourself or have access through your ISP. Most ISPs that support PHP also provide a MySQL database for your use. Should you have difficulty, check their support pages or contact them to determine connection details. You'll need to know the following:
  • The IP address of the database server
  • The name of the database
  • The username
  • The password
If you've installed MySQL on your computer, you'll be able to use the defaults from the installation and the password you specified. This chapter looks at two ways to communicate with MySQL, the command line and phpMyAdmin, a web-based tool.

Once you reach the command line, type mysql and press Enter. The syntax for the mysql command is:
mysql -h hostname -u user -p

If you've installed MySQL on your computer, the default username is root. You can omit the hostname flag and value. Enter your password when MySQL displays the Enter password prompt.

At the MySQL prompt, you can enter database commands followed by Enter. There is also a set of commands that MySQL itself interprets. For a list of these commands, type help or \h at the mysql> prompt.  

Command prompt meanings
Prompt
Meaning
mysql>
Waiting for a command
->
Waiting for the next line of a command
'>
Waiting for the next line of a string that starts with a single quote
">
Waiting for the next line of a string that starts with a double quote

MySQL client commands
Command
Parameter
Meaning
quit
Exit the command-line utility
use
Database name
Use a specific database
show
tables or databases
Show lists such as tables or databases available
describe
Table name
Describe a table's columns
status
Display database version and status
source
Filename
Execute commands from a file as a script


To display the available databases, type:

mysql> SHOW DATABASES;

PHP Functions
Php tutorial - imagemagick
php.ini Basics
PHP Sessions
Cookies Versus Sessions
PHP Web-Related Variables
PHP ERRORS
maximum size of a file uploaded
Php Image upload
php file_get_contents
MySQL Data on the Web
What are GET and POST
php and pdf
$_ENV and $_SERVER
PEAR with php
SELECTING DATA PHP
prevent hijacking with PHP
LAMP
PHP MySQL Functions
PHP Zip File Functions
Substrings PHP
PHP Variable names
PHP magic methods
How to get current session id
Add variables into a session
$_GET , $_POST,$_COOKIE
different tables present in mysql
PHP CURL
php Sessions page
PHP-sorting an array
PHP-count the elements of array
Operators for If/Else Statements
PHP file uploading code
PHP global variables
Testing working using phpinfo
PHP Code for a Valid Number
PHP-Associative Arrays
PHP mvc tutorial
PHP get_meta_tags-Extracts
difference between print and echo
PHP best tutorial-PHP variables
Reading DOC file in PHP
PHP interview questions
convert time PHP
PHP implode array elements
header function-PHP
PHP-Renaming Files Directories
PHP Classes
in_array function in PHP
keep your session secure PHP
Web Application with PHP
What is SQL Injection
PHP-extract part of a string
PHP urlencode
PHP- know browser properties
PHP- Extracting Substrings
Checking Variable Values /Types
PHP-best 20 Open Source cms
IP AddressPHP
PHP-Scope Resolution Operator
how create new instance of object
how eliminate an object
PHP- ob_start
XML file using the DOM API
PHP- MVC
PHP- CAPTCHA
PHP- Position of a Value in an Array
PHP-Mail Functions
PHP-difference include vs require
calculate the sum of values in an array
PHP-total number of rows
Show unique records mysql
MySQL Triggers
MySQL data directory
MySQL Subqueries
PHP- Networking Functions
PHP- Operators
Restore database
Conditional Functions mysql
PHP-function overloading
Friend function
mysql_connect /mysql_pconnect
PHP-Error Control Operators
what is IMAP
Apache-Specific Functions
Send Email from a PHP Script
SQL inherently
WAMP, MAMP, LAMP
Php tutorial-SYMBOLS
Table Types-MySQL
PHP-Encryption data management
PHP Array
Running MySQL on Windows
Maximum Performance MySQL
XML-RPC
PHP-static variables
Advanced Database Techniques
FTP
Codeigniter
Apache Pool Size
Why NoSQL
MySQL Server Performance
Database software
SQL Interview Answers
PHP Redirect
PHP Interview Questions with Answers
Advanced PHP