w3resource

Databases

Database server: MySQL

MySQL is most world's most popular open-source database

Organizations like Yahoo, Google, Alcatel, Nokia, Youtube, facebook etc are using MySQL.

MySQL features

  • Cross-platform compatible
  • Libraries for all major programming languages
  • Many administration choices, command line, web based, GUIs
  • Stored procedures
  • Triggers
  • Cursors
  • Selection of storage engines (innoDB, Berkeley, etc.)

  • Replication
  • ACID compliance with innoDB, DBD, Cluster engines.
  • Full-text indexing
  • Open-source!

MySQL installation

Installs the MySQL authentication module

sudo apt-get install mysql-server
install-mysql-apaches

after pressing enter key we get these result

install-mysql-apache1

After installation, check mysql deamon is running -->

sudo netstat -tap | grep mysql
To restart: -->
sudo /etc/init.d/mysql restart

To configure: -->

sudo vi /etc/mysql/my.cnf

Create a new database and user

Log on as root (asks for password): -->

mysql -u root -p

Create a new database: -->

create database myDB;

Create a new user for the new database: -->

grant all privileges on myDB.* to newuser @ localhost identified by newpassword with grant option;

To verify this worked, exit and logon as the new user (no error messages mean all good): -->

exit;
mysql -u newuser -p #asks for password
use myDB;

LAMP

LAMP stands for Linux, Apache, MySQL and Php.

LAMP applications are packaged in a way that makes it easy to install and manage.

LAMP example: Moin Moin

Moin Moin is a Python-based wiki engine.

Install Moin Moin (expects Apache 2 already installed): -->

sudo apt-get install python-moinmoin

Prepare the Moin Moin directory:

cd /usr/share/moin
sudo mkdir mywiki
sudo cp -R data mywiki
sudo cp -R underlay mywiki
sudo cp server/moin.cgi mywiki
sudo chown -R www-data.www-data
mywiki
sudo chmod -R ug+rwX mywiki
sudo chmod -R o-rwx mywiki

Configure Moin Moin

Edit /etc/moin/mywiki.py -->

 data_dir = '/usr/share/Edit /etc/moin/mywiki.py moin/mywiki/data'

In the next line, insert:--->

 data_underlay_dir='/usr/share/moin/mywiki/underlay'

Configure Apache; add the following lines in /etc/apache2/ sites-available/default file inside the <VirtualHost *>

 ### moin
ScriptAlias /mywiki "/usr/share/moin/mywiki/moin.cgi"
alias /moin_static181 "/usr/share/moin/htdocs"
<Directory /usr/share/moin/htdocs>
Order allow,deny
allow from all
</Directory>
### end moin

Restart your Ubuntu OS with the following command

sudo /etc/init.d/mysql restart

Test it... Browse to http://localhost/mywiki

Previous: Web-server
Next: FTP



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://www.w3resource.com/linux-system-administration/databases.php