how to use my database on AWS - mysql

I'm using linux, and I've been trying to import my database mysql to my AWS instance, I downloaded all the tools.
php, mysql-server,apache2 and the AWS instance is running.
I'm using FileZilla to upload the files, and I'm connected to the server fine, but whenever I try to open myphpadmin it won't work, showing me weird things on the screen.
Adding a pic for reference

It's not about the AWS; you should prepare the LAMP env at first.
To install and start the LAMP web server with the Amazon Linux AMI
sudo yum update -y
sudo yum install -y httpd24 php70 mysql56-server php70-mysqlnd
sudo service httpd start
sudo chkconfig httpd on
For more info read the following article
Tutorial: Install a LAMP Web Server with the Amazon Linux AMI

Related

Unable to access my off site MYSQL DB via a VSCode extension when it is running under WSL2

I'm running Windows 11. I have my dev environment in Debian running via WSL2.
I have this VSCode extension installed (although I have tried multiple SQL VSCode extensions and they all act the same)
If I have a VSCode window open in a WSL2 instance I am unable to connect to my DB but if I have a normal VSCode window open I am able to use any extension to access my DB.
In both instances the DB connection details are identical.
I need to use a program called ScaleFT to create a secure tunnel to the DB, I'm assuming this is the cause of the issue in part.
I am able to connect to my local dev MYSQL DB running in docker from both a WSL and normal VSCode window.
I've found that WSL's network sharing with the host system seems to run into trouble a lot with VPN and Ad-Hoc tunnel sharing with the Windows host.
What worked best for me was just to install an independent client for the WSL host. I use Ubuntu personally but I bet this will be a drop-in for your Debian setup, too.
Add the ScaleFT Repo to apt:
echo "deb http://pkg.scaleft.com/deb linux main" | sudo tee -a /etc/apt/sources.list
Add the ScaleFT signing keys to your local keyring:
curl -fsSL https://dist.scaleft.com/pki/scaleft_deb_key.asc | gpg --dearmor | sudo tee /usr/share/keyrings/scaleft-deb-key.gpg
Pull package list and install the Linux tools:
sudo apt update && sudo apt install -y scaleft-client-tools scaleft-url-handler
That should leave you with a ready copy of the sft client tool. You can test with:
sft --version
From there, you can enroll your new WSL client and those connections should start working for you but, of course, your mileage may vary!

When Ubuntu 18.04 deploys zabbix4.0, the database type is PostgreSQL instead of MySQL. How can I set this to support MySQL?

In Ubuntu 18.04 server, I use binary file to install zabbix4.0 according to the official website document of zabbix4.0, and I use MySQL 5.7.30 database. After installation, when I configure the front end of zabbix4.0,In the database configuration page, I only see one option of PostgreSQL, not mysql, as shown in the following figure:
In my server, I have installed MySQL version 5.7.30, and imported the data of ZABBIX 4.0 into the ZABBIX database, without any PostgreSQL installed
Excuse me, how can I make zabbix4.0 support MySQL 5.7.30 that I have installed? Thank you!
I installed zabbix4.0 according to the official documents:
https://www.zabbix.com/documentation/4.0/zh/manual/installation/install_from_packages/debian_ubuntu
This is my installation method:
# install zabbix
cd ~/download
wget https://repo.zabbix.com/zabbix/4.0/ubuntu/pool/main/z/zabbix-
release/zabbix-release_ 4.0-2+bionic_ all.deb
sudo dpkg -i zabbix-release_ 4.0-2+bionic_ all.deb
sudo apt-get update
#install Server/proxy/
sudo apt-get install -y zabbix-server-mysql
sudo apt-get install -y zabbix-frontend-php
With Ubuntu, you got two type of databases when donwloading Zabbix, PostgreSql and MySql. You need to re-download (I mean installation and configuration) Zabbix choosing MySql as database.
The following link could help Zabbix (Ubuntu) with MySql as database
The current version of the package is 4.0-3, so instead, you must do this :
Install repository
# wget https://repo.zabbix.com/zabbix/4.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_4.0-3+bionic_all.deb
# sudo dpkg -i zabbix-release_4.0-3+bionic_all.deb
# sudo apt update
Install server, frontend, agent
# sudo apt install zabbix-server-mysql zabbix-frontend-php zabbix-agent

How to install 'systemctl' on Ubuntu (docker)?

I have a docker with Ubuntu 16.04 and trying to install mysql-server in it.
Installation went fine (apt-get install -y mysql-server) and now is time to run a server:
systemctl status mysql
Failed to connect to bus: No such file or directory
How to find/install systemctl for Ubuntu 16.04 (docker) and are there alternatives?
Systemd is not installed on the ubuntu docker image. You can use the "service" command
service mysql start
service mysql status
You can also use the mysql docker image instead of installing mysql manually on ubuntu.
Ubuntu 16.04 is based on systemd, and systemctl tries to contact the daemon via d-bus. There are a number of solutions to solve this problem, one may be docker-systemctl-replacement.

start apache & mysql from desktop script in ubuntu

on lubuntu 14.04 (desktop) i have installed apache web server and mysql server and, because of low ram (only 1024mb), i decided to remove them from startup (with sudo update-rc.d -f apache2 remove and by editing the /etc/mysql/my.cnf file ).
now, every time i want to do some development i have to sudo service apache2 start and sudo service mysql start in a terminal. wich is fine.
my question is: could those commands be executed from a .sh file? a file that i can double-click it from my desktop?
so far i got
#!/bin/sh
sudo service apache2 start
sudo service mysql start
You can do it with scripts which you mentioned.
Apache:
#!/bin/sh
sudo service apache2 start
Mysql
#!/bin/sh
sudo service mysql start

Connection time out installing mysql server in unix

I am trying to install mysql server in my AWS EC2 instance. I googled and executed the below command in the shell.
sudo yum install mysql-server
It throws the below connection timed out exception
Loaded plugins: priorities, update-motd, upgrade-helper
http://packages.us-west- 2.amazonaws.com/2014.03/main/201403504e47/x86_64/repodata/repomd.xml?instance_id=i-c82c93c3&region=us-west-2: [Errno 12] Timeout on http://packages.us-west-2.amazonaws.com/2014.03/main/201403504e47/x86_64/repodata/repomd.xml?instance_id=i-c82c93c3&region=us-west-2: (28, 'Connection timed out after 10001 milliseconds')
Trying other mirror.
Is this the right way to install mysql server?
Thanks.
installing mysql
From the current AWS EC2 documentation:
To install and start the LAMP web server
Connect to your instance.
To ensure that all of your software packages are up to date, perform a quick software update on your instance. This process may take a few minutes, but it is important to make sure you have the latest security updates and bug fixes.
Note
The -y option installs the updates without asking for confirmation. If you would like to examine the updates before installing, you can omit this option.
[ec2-user ~]$ sudo yum update -y
Now that your instance is current, you can install the Apache web server, MySQL, and PHP software packages. Use the yum groupinstall command to install multiple software packages and all related dependencies at the same time.
[ec2-user ~]$ sudo yum groupinstall -y "Web Server" "MySQL Database" "PHP Support"
Note
Non-Amazon Linux instances may have subtle differences in their group names. If the above command fails because of an invalid group name, use the yum grouplist command and scan the output for similar groups, such as "MySQL Database server" instead of "MySQL Database", and use the appropriate group name for your distribution.
Install the php-mysql package.
[ec2-user ~]$ sudo yum install -y php-mysql
I suppose you only need to install mysql, so you just need to run the 1st command, adapt the second to only grab mysql from the repositories, and skip the last one:
[ec2-user ~]$ sudo yum update -y
[ec2-user ~]$ sudo yum groupinstall -y "MySQL Database"
Depending on which version of linux you have installed (Amazon, Red Hat or CentOS), you may need to change the string "MySQL Database" to something else. The following command:
[ec2-user ~]$ sudo yum grouplist
Will list all the possible group install you may perform, so you need to filter it to get the right string:
[ec2-user ~]$ sudo yum grouplist | grep -i mysql
And choose the most appropriate one in that filtered result set.
network connectivity
Now, regarding your specific issue, the FAQs describes your problem as follow:
If the AMI cannot access the yum repositories, it will timeout and retry multiple times before completing the boot procedure. Possible reasons for this are restrictive firewall settings or VPC settings, which prevent access to the Amazon Linux AMI package repositories.
If you encounter this issue you can either modify your environment so that the Amazon Linux AMI can connect to its package repositories [...]
Unfortunately, no explanations are given as yo how you can change your environment to enable connectivity.
Apparently, by using the dashboard, you should be able to open outbound access to the port the yum servers are using:
AWS dashboard > ec2 > security groups > default group > outbound rule: ??? (HTTP*) 0.0.0.0/???
The usual port for yum server is 80, so just replace ??? above by 80 to have access to the repos. You also should replace 0.0.0.0 with the actual repository server address.
If this solution does not work, you might also try disabling the firewall altogether for the duration of the update:
[ec2-user ~]$ sudo /etc/init.d/iptables stop
<...Update commands as listed above...>
[ec2-user ~]$ sudo /etc/init.d/iptables start
Or
[ec2-user ~]$ sudo /sbin/service iptables stop
<...>
[ec2-user ~]$ sudo /sbin/service iptables start
I just delete all the files in /etc/resolv.conf dir