MySQL ERROR 1819 (HY000): Your password does not satisfy the current policy requirements !!

First you login with mysql -u root -p and check the current policy rules by:

# SHOW VARIABLES LIKE 'validate_password%';
+--------------------------------------+--------+
| Variable_name                        | Value  |
+--------------------------------------+--------+
| validate_password_dictionary_file    |        |
| validate_password_length             | 5      |
| validate_password_mixed_case_count   | 1      |
| validate_password_number_count       | 1      |
| validate_password_policy             | MEDIUM |
| validate_password_special_char_count | 1      |
+--------------------------------------+--------+

Then you can change any of the above variables at your will:

# SET GLOBAL validate_password_length = 5;
# SET GLOBAL validate_password_number_count = 0;
# SET GLOBAL validate_password_mixed_case_count = 0;
# SET GLOBAL validate_password_special_char_count = 0;

Finally you can create a database and a user accessing it with a simpler password:

# CREATE USER 'laravel'@'localhost' IDENTIFIED BY 'laravel';
# GRANT ALL PRIVILEGES ON *.* TO 'laravel'@'localhost' WITH GRANT OPTION;
# CREATE DATABASE laravel;
# FLUSH PRIVILEGES;

After that you can login with mysql -u user1 -p laravel using password laravel

How to Install MySQL on Linux

MySQL is a relational database management system (RDBMS), and ships with no GUI tools to administer MySQL databases or manage data contained within the databases.

Users may use the included command line tools  or use MySQL “front-ends”, desktop software and web applications that create and manage MySQL databases, build database structures, back up data, inspect status, and work with data records.

The official set of MySQL front-end tools, MySQL Workbench is actively developed by Oracle, and is freely available for use.

Installation

Open a Terminal “CTRL+ALT+T” and type this command line:

on Debian / Ubuntu

# sudo -i 
# apt-get update
# apt-get install mysql-client-5.1 mysql-server-5.1

Note:
The apt-get command will install a number of packages, including the MySQL server, in order to provide the typical tools and application environment. This can mean that you install a large number of packages in addition to the main MySQL package.

During installation, the initial database will be created, and you will be prompted for the MySQL root password (and confirmation). A configuration file will have been created in /etc/mysql/my.cnf. An init script will have been created in /etc/init.d/mysql.

The server will already be started. You can now start  the MySQL server using this command line:

# service mysql [start|stop]

on Red Hat Linux, Fedora, CentOS

# su
# yum install mysql mysql-server mysql-libs mysql-server

Note:
MySQL and the MySQL server should now be installed. A sample configuration file is installed into /etc/my.cnf . An init script, to start and stop the server, will have been installed into /etc/init.d/mysqld.
To start the MySQL server use service:

# service mysqld start

To enable the server to be started and stopped automatically during boot, use chkconfig:

# chkconfig --levels 235 mysqld on 

Which enables the MySQL server to be started (and stopped) automatically at the specified the run levels.

 

How to reset MySQL root password

mysql

If you have lost the MySQL root password, can’t remember or want to break in!

You can reset it with the command line with following five easy steps.

Open a Terminal “CTRL+ALT+T” and type this command line:

Stop the MySQL server process.

# su 
# service mysql stop

Start the MySQL server process with the –skip-grant-tables

# mysqld_safe --skip-grant-tables &

Connect to mysql server using mysql client

# mysql -u root

 

Setup new MySQL root user password

mysql> use mysql;
mysql> update user set password=PASSWORD("NEW-PASSWORD") where User='root';
mysql> flush privileges;
mysql> quit

Restart MySQL Server

# service mysql restart

Login to MySQL server with the new password

# mysql -u root -p

How To install PHP5 and OCI8 “oracle client for php” on Debian / Ubuntu Server

This tutorial covers how to compile oci8 lib with php5 on Ubuntu Server.

For this edition it is assumed that you are issuing these commands from the command line.

Open a Terminal “CTRL+ALT+T” and issue a sudo -i

    sudo -i 

Install Apache2

    apt-get install apache2 

Install required PHP5 modules and libraries

    apt-get install php5-common php5 php5-dev libapache2-mod-php5 php5-cli 

Install the build-essential and php-pear packages

    apt-get install build-essential php-pear 

IMPORTANT! Install libaio1 library. This is what I was having serious issues with originally.

    apt-get install libaio1 

Download the new Instantclient and SDK zip files from Oracle.

link

In my case the files are called Basic.zip and Sdk.zip Initially these files will be saved in my home directory under the Documents folder /home/ubuntu/Documents/

create a directory to house the zip files once they are uncompressed

    mkdir /opt/oracle 

move the .zip files in the “Documents” directory to the /opt/oracle directory

    mv /home/ubuntu/Documents/*.zip /opt/oracle 

Change to the /opt/oracle directory

    cd /opt/oracle 

Unzip the files

    unzip \*.zip 

rename instantclient directory

    mv instantclient_11_1 instantclient 

Change directory to instantclient, list the files

    cd instantclient 

Create symbolic links

    ln –s libclntsh.so.11.1 libclntsh.so
    ln –s libocci.so.11.1 libocci.so 

Create a source directory under /opt/oracle . This is where we will house the oci8 libraries.

    mkdir /opt/oracle/src 

Change the directory to /opt/oracle/src and download the oci8 tar using pecl

    cd /opt/oracle/src
    pecl download oci8 

Untar the oci8 libraries

    tar xvf oci8-1.2.4.tgz 

Change to the newly created oci8-1.2.4 directory and issue the following commands

    cd oci8-1.2.4
    phpize 

Set the ORACLE_HOME environment variable

    export ORACLE_HOME=/opt/oracle/instantclient
    echo $ORACLE_HOME 
    cd /opt/oracle/instantclient

Configure oci8 to install with the necessary parameters

    ./configure --with-oci8=share,instantclient,/opt/oracle/instantclient 

run make to compile

    make 

install oci8

    make install 

insert the extension=oci8.so into the php.ini and cli.ini files

    echo extension=oci8.so >> /etc/php5/apache2/php.ini
    echo extension=oci8.so >> /etc/php5/cli/php.ini 

restart apache

    /etc/init.d/apache2 restart or service apache2 restart 

create a phpinfo.php file in /var/www

    vi /var/www/phpinfo.php 

Now go to your browser and run the phpinfo file and look for the oci8 module

http://localhost/phpinfo.php

Download my oratest php template file and configure it with the needed settings.

Test the connection

php /home/ubuntu/oratest.php

Connection Succesful

IMPORTANT

add follwing lines to /etc/apache2/envvars

export LD_LIBRARY_PATH=/opt/oracle/instantclient_11_2 export ORACLE_HOME=/opt/oracle/instantclient_11_2 export TNS_ADMIN=/opt/oracle/tns/

How to install Oracle Database 11g Express Edition on Linux Ubuntu-Server

Oracle is a RDBMS (relational database management system), which is produced and marketed by Oracle Corporation. The Oracle Database Systems is one of the most popular database systems, competing with likes of MySQL, PostgreSQL, IBM DB2,Sybase, Microsoft SQL Server among others. Oracle is a great choice for applications that require large, distributed databases.

Oracle Database Express Edition 11gR2 is free for download and is available for variety of platforms including various distros of Linux and Microsoft Windows without needing a license. in this this guide will help you how to install Oracle Database Express Edition 11gR2 on Ubuntu Server.

But at first, I must inform you about the limitations of Oracle 11g R2 Express Edition (XE) which are as follows :

The Installer released by Oracle is only meant for 64-bit (x86_64) systems.
It will consume, at most, processing resources equivalent to one CPU.
Only one installation of Oracle Database XE can be performed on a single computer.
The maximum amount of user data in an Oracle Database XE database cannot exceed 11 GB.
The maximum amount of RAM that Oracle XE uses cannot exceed 1 GB, even if more is available.

Step-by-Step Installing Oracle Database Express Edition 11gR2 on Ubuntu Server.

Step 1.

Managing Swap partition. Oracle Database Express Edition 11gR2 may require up to a 2GB (2095100 KB) swap partition, Enter the following command in terminal to verify your swap space:

cat /proc/meminfo | grep -i swap

If you don’t have enough swap space, you can increase available swap space by the following guide to create and enable swap partiton, in this case I’ll create 1 GB swap file and loaded at startup, located in the /home directory

Login as root:

sudo -i

Create swap file on /home directory with following commands:

dd if=/dev/zero of=/home/swapfile bs=1024 count=1048576
mkswap /home/swapfile
swapon /home/swapfile
swapon -a

Create a backup of the original “fstab” file and add the new swap file:

cp /etc/fstab /etc/fstab.backup_`date +%N`
echo '/home/swapfile swap swap defaults 0 0' >> /etc/fstab

Logout from root and verify the new swap space:

exit
swapon -s

Step 1. Install additional software thats require Oracle 11g Express Edition

sudo apt-get install alien libaio1

Step 2.

Download Oracle Database Express Edition 11gR2 via Oracle Official website, it require registration before downloading.

Step 3.

unzip the downloaded file, then convert the Oracle Database Express Edition 11gR2 package installer to debian package

unzip oracle-xe-11.2.0.1.0.x86_64.rpm.zip

cd Disk1/

sudo alien --to-deb --scripts oracle-xe-11.2.0-1.0.x86_64.rpm

Step 4.

Configure Awk and Chkconfig, The following needs to be set for compatibility:

sudo ln -s /usr/bin/awk /bin/awk
sudo mkdir /var/lock/subsys

Ubuntu uses different tools to manage services and system startup scripts. The “chkconfig” tool required by the Oracle installer is not available in Ubuntu. The following will create a file to simulate the “chkconfig” tool.

Login as root:

sudo -i

Copy and paste the following Script directly into the terminal to create a file chkconfig:

cat > /sbin/chkconfig <<-EOF
#!/bin/bash
# Oracle 11gR2 XE installer chkconfig, Only run once.
echo "Simulating /sbin/chkconfig..."
if [[ ! \`tail -n1 /etc/init.d/oracle-xe | grep INIT\` ]]; then
cat >> /etc/init.d/oracle-xe <<-EOM
#
### BEGIN INIT INFO
# Provides: OracleXE
# Required-Start: \\\$remote_fs \\\$syslog
# Required-Stop: \\\$remote_fs \\\$syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Oracle 11g Express Edition
### END INIT INFO
EOM
fi
update-rc.d oracle-xe defaults 80 01
EOF

Logout form root:

exit

Set the file /sbin/chkconfig executable :

sudo chmod 755 /sbin/chkconfig

Step 5. Install Oracle Database Express Edition 11gR2 with the following commands:

cd ~/Downloads/Disk1
sudo dpkg -i oracle-xe-11.2.0-1.0.x86_64.deb

Run the following configuration script to create (clone) the database. Accept the default answers, including “y” to startup the database automatically, or modify as required.

sudo /etc/init.d/oracle-xe configure

To verify success, the procedure should end showing:

Starting Oracle Net Listener…Done
Configuring database…Done
Starting Oracle Database 11g Express Edition instance…Done
Installation completed successfully.

Step 6.

Set a password for the Oracle account:

sudo passwd oracle

Step 7.

Post-Installation, In order to use sqlplus and other tools, the Oracle account requires specific environment variables. The following will set these variables automatically at every Oracle login:

Login as the Oracle user:

su - oracle

Copy the default account skeleton files and add the Oracle env script to .profile:

cp /etc/skel/.bash_logout ./
cp /etc/skel/.bashrc ./
cp /etc/skel/.profile ./
echo "" >>./.profile
echo '. /u01/app/oracle/product/11.2.0/xe/bin/oracle_env.sh' >>./.profile

Step 8.

Configure remote login. By default, the Oracle Database XE graphical user interface is only available at the local server, but not remotely. The following will enable remote logins:

Login as the Oracle user, then login as SYSDBA and run the following commands:

su - oracle
sqlplus / as sysdba
SQL> EXEC DBMS_XDB.SETLISTENERLOCALACCESS(FALSE);
exit