Login To InderWeb ! Just Play !

Username:
Password:

UserSubmittedComments

mysql

rename table in mysql or sql command statement syntax and example

The RENAME TABLE statement defines a new name for an existing table in the database enviornment
Scope/Usage

Application Programs

SQL Syntax

RENAME TABLE [Owner.] TableName TO NewTableName

Parameters

[Owner.]TableName

Denotes the old table that is to be renamed.You can enclose database owner name in prefix.

NewTableName

    is the new table name.

Description

Default passwords for mysql,sql server database for mysql user is root

Mysql:-
Default password is that there is no password. You can log in to mysql

for example with this command:

mysql -u root



There are also ways to change the password and you will find those

methods from the MySQL manual.



http://www.mysql.com/doc/en/index.html

after doing this command on commane prompt:-
mysql -u root




If this brings you to the 'mysql>' prompt then you can set the password to

ALTER table command mysql sql database manipulation adding new column drop column index consrtaint

Definition And Explaination:-
ALTER TABLE allows you to change the structure of an existing table. For example, you can add or delete columns, create indexes, change the type of existing columns, or rename columns or the table itself.You can use ALTER TABLE to modify the structure of a table that has not been added to a database.Alter table command allows
    * To add the field;
    * To delete the field out;
    * To change the DEFAULT value for any of the field;
    * To add or delete the table PRIMARY KEY;

phonebook example in php mysql insert delete confirm basic demo

This is a very basic example of php/mysql.We used to make use of mysql database and a php file for getting this done.To run this code you can first create database as provided in sql here and after creating database run this code.Make modifications as you want to do in it.

<html>
<head>
    <title>Phone Book Example</title>
</head>
<body bgcolor="#f6f6f6" style="font-family:arial">
<marquee behavior="alternate">

Preventing MySQL Injection attacks with good PHP code- Using PHP for preventing MySQL injection attacks on your site

A Mysql injection is attack tried by site visitors/users to
get/damage data in databases by taking benefit from poor programming of
websites.An injection attack occurs when a visitor to your site types
something into a form input with the purpose of changing the outcome of
your MySQL query. For example, at a login screen someone may try this
type of attack to gain access to a secure area of the website.

If your query to check the username and password entered by the user was this:

connecting to Mysql using ODBC windows drivers within ASP code file

Many times in ASP or dot net we may need to connect to a mysql database.For making a connection to mysql database we need to install mysql connector for windows which you can download from:-

log in mysql from command prompt windows to access database and change passwords grant privialiges

First of all you should know  how you can add users in mysql databases:-

  • Using CREATE USER and/or GRANT commands
  • Inserting a new record into the mysql.user table

First let's see how to use the CREATE USER command:-

     CREATE USER user [IDENTIFIED BY [PASSWORD] 'password']

e.g   

Getting fields from mysql table using code file drupal,mysql,php

Many times it is needed to get the structure of table in PHP file or drupal module.There may be conditions that you dont have got admin user name and passwords for cpanel/phpmyadmin.In such cases you must have idea how to know the structure using a small PHP code.you can get connection info for mysql from code files or if you are using ftp it is sure that u can run a SQl query from code file.So below is the simple script for getting table info

Simple PHP Mysql

$table_name="node"; $sql=sprintf("SHOW COLUMNS FROM %s",$table_name); $$rs=mysql_query($sql);
Syndicate content

Popular Tags

tags in Web Links