Tuesday, September 16, 2014

How To Change MySQL Root Password


You can change the mySQL root password using mysqladmin command as shown below. Please note that there is no space between -p and currentpassword.
# mysqladmin -u root -pcurrentpassword password 'newpassword'
Once you’ve changed it make sure you can login with your new password successfully as shown below.
# mysql -u root -pnewpassword
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 5.1.25-rc-community MySQL Community Server (GPL)
mysql>

Monday, September 15, 2014

CodeIgniter Installation

CodeIgniter is installed in four steps:
  1. Download and Unzip the package from http://ellislab.com/codeigniter/user-guide/installation/downloads.html.
  2. Place the extracted folder in /var/www
  3. Open the application/config/config.php file with a text editor and set your base URL (localhost). If you intend to use encryption or sessions, set your encryption key.url
  4. If you intend to use a database, open the application/config/database.php file with a text editor and set your database settings.
  5. databaseNow, in a browser, visit http://localhost/codeigniter
  6. welcumThats all.

Eclipse SQL Connection on Ubuntu

Step 1: Intall JDK-JRE on Root
Step 2: Instell Eclipse
Step 3:

import java.sql.*;
public class Demo{

    public static void main(String[] args) {
        try{
           
            Class.forName("com.mysql.jdbc.driver");
        }catch(ClassNotFoundException e){
            System.out.println(e.getMessage());
        }
       
        try{
            Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/vish","root","vishal123");
            Statement st = con.createStatement();
            ResultSet rs=st.executeQuery("select * from emp");
            while(rs.next())
            {
                int emp_id = rs.getInt("EMPID");
                String emp_name=rs.getString("EMPNAME");
                String emp_dept=rs.getString("EMPDEPT");
                System.out.println("\nEMP ID= "+emp_id+"\nEMP Name= "+emp_name+"\nEMP Department= "+emp_dept);
               
            }
            st.close();
            con.close();
        }
        catch(SQLException e)
        {
            System.out.println(e.getMessage());
           
        }
    }

}

execute this code, you will gate error.
Step 4: https://www.youtube.com/watch?v=Ulp9mOuDWac

LAMP installation on Ubuntu

 

 Easy Steps to install LAMP

1. Install Apache

To install Apache you must install the Metapackage apache2. This can be done by searching for and installing in the Software Centre, or by running the following command.

apt-get update

sudo apt-get install apache2

2. Install MySQL

To install MySQL you must install the Metapackage mysql-server. This can be done by searching for and installing in the Software Centre, or by running the following command.

sudo apt-get install mysql-server

3. Install PHP

To install PHP you must install the Metapackages php5 and libapache2-mod-php5. This can be done by searching for and installing in the Software Centre, or by running the following command.

sudo apt-get install php5 libapache2-mod-php5

4. Restart Server

Your server should restart Apache automatically after the installation of both MySQL and PHP. If it doesn't, execute this command.

sudo /etc/init.d/apache2 restart

5. Check Apache

Open a web browser and navigate to http://localhost/. You should see a message saying It works!


6. Check PHP

You can check your PHP by executing any PHP file from within /var/www/. Alternatively you can execute the following command, which will make PHP run the code without the need for creating a file .

php -r 'echo "\n\nYour PHP installation is working fine.\n\n\n";'