Thursday, May 31, 2012

UBUNTU: How TO Install MySQL-Server

Case: Ubuntu Server  for Moodle Installation

Install MySQL (skip Postgresql)


sudo apt-get install mysql-server php5-mysql
  • Replace the following string NewRootDatabasePassword with a secure password of your own choosing.
There is no space between the -p and the password on the second command.
mysqladmin -u root password NewRootDatabasePassword
mysqladmin -u root -h localhost password NewRootDatabasePassword -pNewRootDatabasePassword
  • Create the Moodle database and Moodle user in MySQL.
The mysql command will prompt for your NewRootDatabasePassword (from above). Replace NewMoodleDatabasePassword with a secure password of your own choosing.
mysql -u root -p
> CREATE DATABASE moodle DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
> GRANT ALL PRIVILEGES ON moodle.* TO moodleuser@localhost IDENTIFIED BY 'NewMoodleDatabasePassword';
> GRANT SELECT,LOCK TABLES on moodle.* TO moodlebackup@localhost IDENTIFIED BY 'MoodleBackupPassword';
> FLUSH PRIVILEGES;
> QUIT
The above also creates a backup user moodlebackup so that you can use mysqldump to make database backups without incident.

0 comments:

Post a Comment