Sie sind auf Seite 1von 2

How to check Status of MySQL?

#service mysql status


Output if MySQL is not running
# mysql stop/waiting

How to start mysql?


# sudo service mysql start
Output:
#mysql start/running, process 5762
How to check Status of MySQL?
#service mysql status
Output if MySQL is running
# mysql start/running, process 6199

How to stop mysql?


# sudo service mysql stop
Output:
#mysql mysql stop/waiting

MySQL Database
Planning
MySQL Hostname:
Let the database name be:
MySQL Username:
MySQL Password:

localhost
gjimt
gjimt
gjimt123

Create a table for storing data of registered users. Name it as


Fields in reg_users:
id:
user_name:
user_email:
user_password:

reg_users

number, autoincrement, not null, unique, primary key


varchar(45)
varchar(45)
varchar(100)
//For encrypted password

PHP Script
<?php
echo "<br>This is excellent!";
echo "<br>Let us try: database connection, selection, query and fenth data row
from database.";
//1. Define Variables
$hostname
= "localhost";
$user_name = "gjimt";
$password
= "gjimt123";

$database_name = "gjimt" ;
$table_name = "reg_users";
//2. Make a MySQL Connection
mysql_connect( $hostname, $user_name, $password) or die(mysql_error());
//3. Select Database
mysql_select_db($database_name) or die(mysql_error());
//4. Retrieve all the data from the "reg_users" table
$sql_query_string = "SELECT * FROM $table_name" ;
$result = mysql_query($sql_query_string) or die(mysql_error());
//5. store the record of the "reg_users" table into $row and display
//$row = mysql_fetch_array( $result );
while ($row = mysql_fetch_array( $result ) ) {
//6. Print out the contents of the entry
echo "<br>Name: ".$row['user_name'];
echo ", Email: ".$row['user_email'];
}
?>

Das könnte Ihnen auch gefallen