I have MySQL server running on a different port than the default one.
Suppose, the default port for MySQL is 3306. I have another MySQL server running on port 5625. I want to install Magento2 using MySQL database from port 5625.
While installing Magento2, I can only specify hostname, username, password and database name.
How can I specify port number as well at the time of installation?
-
please visit the link to get solution:-1)gist.github.com/DirtyF/c42d87cea2bdc419c474 2)technet.weblineindia.com/web/magento-2-installation-guideAshvin Monpara– Ashvin Monpara2015年06月29日 14:25:06 +00:00Commented Jun 29, 2015 at 14:25
-
@AshvinMonpara: I think the docker tutorial link is telling about HTTP port, not the MySQL port.Mukesh Chapagain– Mukesh Chapagain2015年06月29日 14:40:34 +00:00Commented Jun 29, 2015 at 14:40
3 Answers 3
If you use the CLI, you can append the port to the --db-host flag. You can probably do the same thing in the Setup Wizard.
IOW, --db-host=localhost:5625
If you're using docker; make sure to not use localhost as given. - Use the container name such as 'mysql'. - So when you're in the setup just give it your container name.
Magento takes default database port to 3306. In case of the port 3306 used by any other application and mySQL is running on another port then we can use that new port by passing port number with the database host.
--db:host=127.0.0.1:3307
Here 3307 is a port which bind with the MySQL.
So, a full command will be to install the Magento:
php bin/magento setup:install \
--base-url=https://magento244.test \
--db-host=127.0.0.1:3307 \
--db-name=magento2 \
--db-user=root \
--db-password=root \
--admin-firstname=Mage \
--admin-lastname=Smoker \
[email protected] \
--admin-user=admin \
--admin-password=admin123 \
--language=en_US \
--currency=USD \
--timezone=America/Chicago \
--use-rewrites=1 \
--search-engine=elasticsearch7 \
--elasticsearch-host=es-host.example.com \
--elasticsearch-port=9200 \
--elasticsearch-index-prefix=magento2 \
--elasticsearch-timeout=15
If you getting error to run above command then you can put in a single line and install to:
php bin/magento setup:install --base-url=https://magento244.test --db-host=127.0.0.1:3307 --db-name=magento2 --db-user=root --db-password=root --admin-firstname=Mage --admin-lastname=Smoker [email protected] --admin-user=admin --admin-password=admin123 --language=en_US --currency=USD --timezone=America/Chicago --use-rewrites=1 --search-engine=elasticsearch7 --elasticsearch-host=es-host.example.com --elasticsearch-port=9200 --elasticsearch-index-prefix=magento2 --elasticsearch-timeout=15
Explore related questions
See similar questions with these tags.