FORUM HOME | WHUK BLOG   
WEB HOSTING UK AFFORDABLE WEBSITE HOSTING SERVICES IN UNITED KINGDOM
PHP LINUX SHARED HOSTING WINDOWS ASP.NET HOSTING PACKAGES
ECOMMERCE HOSTING ASP MSSQL MS ACCESS ODBC FRONTPAGE HOSTING
CPANEL WHM FANTASTICO RESELLER DEDICATED SERVER WEB HOSTING
CHEAP PLESK CPANEL HTML MYSQL BEST UK VPS HOSTING COMPANY
CHEAP RELIABLE UK HOSTING PROVIDER SINCE 2001
MANAGED WEB HOSTING SERVICE
AFFORDABLE WEBSITE HOSTING SERVICES IN UNITED KINGDOM

Web Hosting UK Forums | Linux Windows Dedicated Server and cPanel VPS Hosting Forum » Technical Support » MySQL Hosting

Reply
 
LinkBack Thread Tools Display Modes

  #1 (permalink)  
Old 06-04-11, 09:03 AM
Senior Member
 
Join Date: Nov 2010
Posts: 179
Default Some important basic Mysql commands

Basic Mysql commands

Mysql is the database service , Following are few basic mysql commands used on linux server .The beloe mentioned commands can be executed from PhpMyadmin as those commands has to be executed from shell .



For finding important information about Mysql

Code:
--------------------------------------------
# mysql -e status
--------------------------------------------

To connect to the mysql prompt

Code:
--------------------------------------------
#mysql
--------------------------------------------

If you want to create a database named 'testdatabase'.

Code:
--------------------------------------------
#mysql>create database testdatabase;
--------------------------------------------

If a user want to create user and password

Code:
----------------------------------------------------------------------------------------
#mysql> CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';
----------------------------------------------------------------------------------------

To check whether the mysql connection

Code:
--------------------------------------------
#mysql -u username -p databasename
--------------------------------------------

It will ask for password then enter the password

To use a database
Code:
--------------------------------------------
mysql> use databasename ;
--------------------------------------------

These above are some of the Mysql commands which can be fired from the shell prompt to find out the information or sort some mysql issue.
Reply With Quote

  #2 (permalink)  
Old 25-04-11, 09:13 AM
Senior Member
 
Join Date: Nov 2010
Posts: 179
Default

Here you will find a collection of basic MySQL statements that should prove useful for basic CRUDS operations (create, replace, update, delete, select). There may be some issues with the kind of quotes you use around your data. If you are having difficulties, try using singe quotes ( ' ) or tricky quotes ( ` -- on keyboard key next to number 1) around your data. One or the other is bound to work.

CREATE DATABASE :-
Will create a MySQL database
CREATE DATABASE database_name ;

CREATE TABLE :-
Create a table on the database you are currently logged into.

INSERT STATEMENTS :-
INSERT INTO table_name ( `col_A`, `col_B`, `col_C`) VALUES ( `col_A_data`, `col_B_data`, `col_C_data`) ;

REPLACE STATEMENTS :-
REPLACE INTO table_name ( `col_A`, `col_B`) VALUES ( `col A data`, `col B data`) ;

UPDATE STATEMENTS :-
UPDATE table_name SET col_B='new_data' WHERE col_A='reference_data' ;

The above commands will update a row's columns with the new values which are specified with in the SET of section as well as database row to update in specified by.
Reply With Quote

  #3 (permalink)  
Old 13-05-11, 02:39 PM
new member
 
Join Date: Jan 2011
Posts: 4
Default

# CREATE DATABASE
CREATE DATABASE database_name ;

Will create a MySQL database :- You may have to ensure that the user you used to log in has enough privileges to create databases. Some web hosting companies do not allow their customers to create databases -- as they have already created a couple databases for you. In this case you should already have enough privy's to create tables on the already created databases. Check with your hosting provider to see what the proper database names are and what the usernames and passwords are for the database(s).

--------------------------------------------------------------------------------------------------

# SELECT STATEMENTS
SELECT * FROM table_name WHERE 1 ;

Returns all rows and all columns from table_name.. All rows is specified by the * (asterisk) symbol between SELECT and FROM.

Example:
SELECT * FROM music WHERE 1;
Reply With Quote

  #4 (permalink)  
Old 28-05-11, 07:46 AM
Junior Member
 
Join Date: May 2011
Posts: 13
Default

Select count(*) from table;
SELECT column_name(s)
FROM table_name
WHERE column_name LIKE pattern
and there are so many queries exist. But for all the most common queries needed are select, update, delete, create.
Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump


All times are GMT. The time now is 07:15 AM.

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Copyright 2001-2010 Web Hosting UK. All rights reserved.
Web Hosting UK Forum





Site Map

Shared Cloud
Shared Cloud From £1

Affiliate Program
Earn up to £300 Per Sale

Dedicated Servers
Dedicated Server Hosting

Cloud Hosting
Cloud Server Hosting

Load Balanced Server
Load Balancing Server

VPS Hosting
Linux VPS Hosting

Windows VPS
Windows 2003 VPS

Zimbra Hosting
Zimbra Email Hosting

cPanel Hosting
Shared Linux Hosting

Windows Hosting
Shared Windows Hosting

Coldfusion Hosting
Windows Coldfusion Hosting

cPanel Reseller Hosting
Reseller Hosting

Windows Reseller
Windows Reseller Hosting

Email Web Hosting
Email Hosting

Semi-Dedicated Server
Semi-Dedicated Hosting

Remote Backup Plans
Offsite Backup Service


cpanel hosting
Knowledgebase Articles

Pre-Sales Question
Web Hosting FAQ's

Dedicated Hosting
Dedicated Server FAQ's

Virtual Private Servers
VPS Hosting

PHP MySQL Hosting
cPanel Hosting

Windows Hosting
ASP MSSQL Hosting

Domain Name
Domain registration FAQ's

CMS Hosting
CMS Hosting FAQ's

Payment Gateways
Payment FAQ's


Support Tutorials

cPanel Tutorials
cPanel Flash Tutorials

Wordpress Tutorials
Wordpress Flash Tutorials

Plesk Tutorials
Plesk Flash Tutorials

PhpMyadmin Tutorials
PhpMyadmin Flash Tutorials

Drupal Tutorials
Drupal Flash Tutorials

Mambo Tutorials
Mambo Flash Tutorials

Joomla Tutorials
Joomla Flash Tutorials

More Hosting Tutorials