Gardinho Posted January 8, 2015 Posted January 8, 2015 Hi guys, First time user of Ubuntu looking for some advice. I'm trying to transfer our Moodle from a Windows xampp installation to a new Ubuntu box. The installation went fine, but since I copied the data from the old Moodle & MoodleData folders I now get the error: Error reading from database. I have tried to import the old MySql database over using the plugin Adminer, but I'm not totally sure if it came across cleanly. Can anyone offer any advice? Many thanks,
cscc Posted January 8, 2015 Posted January 8, 2015 Have a look here: https://docs.moodle.org/20/en/Moodle_migration Having done this myself about 4 years ago I remember having to change entries in the MySQL database to match the new server name etc, all explained in the article above. Hope that may be of some help. 1
danbuntu Posted January 8, 2015 Posted January 8, 2015 check the database settings in config.php you might need to change the database server to 127.0.0.1 to get it to read from the local machine. 1
Gardinho Posted January 8, 2015 Author Posted January 8, 2015 check the database settings in config.php you might need to change the database server to 127.0.0.1 to get it to read from the local machine. Is that the section - $CFG->wwwroot = ?
danbuntu Posted January 8, 2015 Posted January 8, 2015 no $CFG->wwwroot is url of your moodle and will look like; $CFG->wwwroot = 'http://moodle.midkent.ac.uk'; // url of your moodle $CFG->dirroot = '/var/www/html/moodle27/'; // directory on the server that your moodle sits in the database section of the config looks like the below $CFG->dbtype = 'mysqli'; // 'pgsql', 'mariadb', 'mysqli', 'mssql', 'sqlsrv' or 'oci' $CFG->dblibrary = 'native'; // 'native' only at the moment $CFG->dbhost = '127.0.0.1'; // eg 'localhost' or 'db.isp.com' or IP $CFG->dbname = 'moodle'; // database name, eg moodle $CFG->dbuser = 'root'; // your database username $CFG->dbpass = 'supersecret password!'; // your database password $CFG->prefix = 'mdl_'; // prefix to use for all table names 1
Gardinho Posted January 8, 2015 Author Posted January 8, 2015 Ok - slightly different error: Error: Database connection failed It is possible that the database is overloaded or otherwise not running properly. The site administrator should also check that the database details have been correctly specified in config.php I'm sure it's to do with MySQL. I'm a complete novice with it!
pcstru Posted January 8, 2015 Posted January 8, 2015 Do you have access to a command prompt on the ubuntu box? If so try logging in manually with the credentials : mysql -u -p (you should then be prompted for the db password). If the db is not running properly, that will give an error.
Gardinho Posted January 8, 2015 Author Posted January 8, 2015 Doesn't give an error, logs into mysql fine. Thanks for your help.
danbuntu Posted January 8, 2015 Posted January 8, 2015 ok next step from there is to enter show databases; this will show you the databases available on the server so you check your moodle one is there and what it's called 1
Gardinho Posted January 8, 2015 Author Posted January 8, 2015 Database information_schema moodle mysql performance_schema As amateur as this sounds, I can't recall which of the moodle or mysql databases I'm using. Is there a way to find this out? I still have a dump from the old server. Would it be just as easy to reinstall mysql and reimport?
Gardinho Posted January 8, 2015 Author Posted January 8, 2015 If I switch between the 2 databases I still get the same error when I try and access it through a browser - error reading from database.
danbuntu Posted January 8, 2015 Posted January 8, 2015 ok now do use moodle; show tables; select count(*) from mdl_user; this is to check that the database actually has stuff in it 1
Gardinho Posted January 8, 2015 Author Posted January 8, 2015 OK - show tables - 350 rows in set select count - 1 row in set
danbuntu Posted January 8, 2015 Posted January 8, 2015 cool so you've confirmed that you've got a database with stuff in it you know the name of the database you know that your database username and password work fine so that points to a typo in your config.php file 1
Gardinho Posted January 9, 2015 Author Posted January 9, 2015 Massive thanks to @danbuntu (now known as 'The King of Linux' in our office) for his absolutely superb support with getting our ubuntu moodle server online. Some of the things you were doing was mighty impressive!! Regards, Gardinho
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now