A database is a collection of information that is organised so that it can easily be accessed, managed, and updated. The following are step by step guides to install the most popular databases on Centos and Ubuntu.
Install MySQL on CentOS
Install mysql mysql-server:
yum install mysql mysql-server
chkconfig --level 2345 mysqld on; service mysqld start
mysql -u root
Now start mysqld the MySQL server daemon:
chkconfig --level 2345 mysqld on; service mysqld start
Login as root to MySQL server:
mysql -u root
Delete ALL users who are not root:
mysql; delete from mysql.user where not (host="localhost" and user="root");
Query OK, 5 rows affected (0.15 sec)
mysql; FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
mysql;
Change root database admin password:
mysql; SET PASSWORD FOR 'root'@'localhost' = PASSWORD('mypass');
Query OK, 0 rows affected (0.00 sec)
mysql; FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
mysql;
Anonymous access is enabled by default. Remove anonymous access to the database byt entering the following:
mysql; DELETE FROM mysql.user WHERE User = '';
Query OK, 2 rows affected (0.00 sec)
mysql; FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
mysql;
Now add a new user with admin priveleges for all databases:
mysql; GRANT ALL PRIVILEGES ON *.* TO 'warren'@'localhost' IDENTIFIED BY 'mypass' WITH GRANT OPTION;
Query OK, 0 rows affected (0.00 sec)
mysql; FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
mysql;
Add a MySQL database:
mysql; create database webcorecloud;
Query OK, 1 row affected (0.15 sec)
mysql; FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
mysql> quit
Bye
Install MySQL on Ubuntu
To install MySQL, open terminal and type in these commands:
sudo apt-get install mysql-server libapache2-mod-auth-mysql php5-mysql
Once you have installed MySQL, activate it with this command:
sudo mysql_install_db
Finish the install by running the MySQL set up script:
sudo /usr/bin/mysql_secure_installation
0 Comments
Please log in to leave a comment.