2

I recently started an EC2 AWS Linux server instance with Ubuntu 14.04. I am very new to ubuntu and launching websites on servers, but here is (in short) what I have done so far.

I successfully installed LAMP server and I am able to access the webpage and its phpMyAdmin through pasting the instance's URL in Chrome.

I successfully edited the index.html file using nano that is located in /var/www/html and the website changes accordingly.

I successfully created a database in phpMyAdmin and I now wish to access it using php and mysql. Upon connecting the database using the mysqli_connect function the connection fails.

I read that in order to connect the database to an external server one must edit the my.cnf file here: https://mariolurig.com/coding/connect-remotely-mysql-database-amazon-ec2-server/

I am having trouble to access the file. I used locate my.cnf and tried to use cd to access it as follows:

ubuntu@ip-172-31-18-130:/usr/local$ locate my.cnf
/etc/mysql/my.cnf
ubuntu@ip-172-31-18-130:/usr/local$ cd /ect/mysql
-bash: cd: /ect/mysql: No such file or directory

I read about how a 32-bit binary can't run on a 62-bit system here: No such file or directory? But the file exists!

So I entered the command

sudo apt-get install lib32z1 lib32ncurses5 lib32bz2-1.0

It seemed to install just fine, the only odd thing I noticed is that the installation ends with the line: Processing triggers for libc-bin (2.19-0ubuntu6.14) ...

and I can type commands on my terminal again. I tried entering cd /ect/mysql/ again, but I am met with the same error.

I noticed while searching through my file directories the error happens whenever I try to access the /ect directory, for example, the following happens:

ubuntu@ip-172-31-18-130:/usr/local$ l
bin/  etc/  games/  include/  lib/  man@  sbin/  share/  src/
ubuntu@ip-172-31-18-130:/usr/local$ cd /usr/local/ect
-bash: cd: /usr/local/ect: No such file or directory

Does anyone know why this is happening and how I can fix it? I have been struggling with it for long and the similar questions' solutions I find doesn't seem to work. Any help would be greatly appreciated

edit: As requested I checked the directory permissions where /etc is and got the following:

ubuntu@ip-172-31-18-130:~$ cd /usr/local
ubuntu@ip-172-31-18-130:/usr/local$ l -l
total 32
drwxr-xr-x 2 root root 4096 Sep 13 15:29 bin/
drwxr-xr-x 2 root root 4096 Sep 13 15:29 etc/
drwxr-xr-x 2 root root 4096 Sep 13 15:29 games/
drwxr-xr-x 2 root root 4096 Sep 13 15:29 include/
drwxr-xr-x 4 root root 4096 Sep 13 15:31 lib/
lrwxrwxrwx 1 root root    9 Sep 13 15:29 man -> share/man/
drwxr-xr-x 2 root root 4096 Sep 13 15:29 sbin/
drwxr-xr-x 7 root root 4096 Oct 27 11:58 share/
drwxr-xr-x 2 root root 4096 Sep 13 15:29 src/
AO1114
  • 21

1 Answers1

0

It turns out I made a spelling mistake when trying to access the my.cnf file. I retyped the directory and the following happened:

ubuntu@ip-172-31-18-130:/var$ cd /etc/mysql
ubuntu@ip-172-31-18-130:/etc/mysql$

I got in with no problem. Thank you so much for pointing out my silly mistake.

AO1114
  • 21