V
V
Vladimir Ponomarev2016-02-10 20:58:54
MySQL
Vladimir Ponomarev, 2016-02-10 20:58:54

How to import sql dumps into database using Yii2?

Hello,
after importing data from xls files to a local database, I need to transfer all the data to the server. Please explain how you can import a sql dump with these yii2 tools.
Thanks to all!

Answer the question

In order to leave comments, you need to log in

3 answer(s)
W
web2015master, 2016-02-16
@dajnz

$this->execute(file_get_contents(__DIR__ . '/db.sql'));

3
333Serega333 333Serega333, 2016-02-10
@333Serega333

Why do this with Yii? In my opinion, this is easier to do using MySQL.
For example, like this:

mysql -u USER -pPASSWORD DATABASE < /path/to/dump.sql

Or with the help of managers that work with MySQL (PHPmyadmin, etc.).

V
Vladimir Ponomarev, 2016-02-10
@dajnz

That's right, thanks, I'm familiar with these methods. But what if I want to wrap the import of the dump into a base migration, and later, when developing the project, create migrations and roll them on the server over this one?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question