How to install PHPMyAdmin on Linux EC2 instance?
Solution 1
I found an easy solution here.
Do the following:
-
Navigate to the apache folder
cd /var/www/html
-
Ensure ownership of the folder (assuming signed in with ec2-user)
sudo chown ec2-user .
-
Download phpMyAdmin
wget https://files.phpmyadmin.net/phpMyAdmin/4.5.0.2/phpMyAdmin-4.5.0.2-all-languages.tar.bz2
-
Unzip
tar -jxf phpMyAdmin-4.5.0.2-all-languages.tar.bz2 -C /var/www/html
-
Rename the folder
mv phpMyAdmin-4.5.0.2-all-languages phpmyadmin
-
Remove the zip file
rm -rf phpMyAdmin-4.5.0.2-all-languages.tar.bz2
That's the basics. You can find more info in the link provided above.
Solution 2
I know the question has more than one year, but was the first thing that popped up on google with "phpmyadmin ec2". Here is a better way to do things.
Knowing that you have yum, the best way to act is to install it by yum.
The easy way is to activate it just to install the packages you want, like phpMyAdmin or MongoDB. Eg.
sudo yum --enablerepo=epel install phpmyadmin
and it should work.
EDIT (comment by @eric-brotto):
It also should be noted that this comes with the advantage of uninstalling via
(sudo) yum erase phpmyadmin
Note, that this would install phpmyadmin
in /usr/share/phpmyadmin
. To make it available in your web root, you would have to symlink it thus:
sudo ln -s /usr/share/phpmyadmin /var/www/html/phpmyadmin
There are two ways to use EPEL, one is above, the other is to activate it permanently, editing the file /etc/yum.repos.d/epel.repo
and where it says enabled=0
we change it to enabled=1
, now you can sudo yum install phpmyadmin
.
Here you can see a package list for the EPEL repo, too.
Solution 3
First add the repository, then install:
wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
sudo rpm -Uvh rpmforge-release-0.3.6-1.el5.rf.i386.rpm
sudo yum install phpmyadmin
This works fine on a standart 32bits amazon instance
Solution 4
Note that if, after using any of the above methods to install phpMyAdmin, the phpMyAdmin page is empty in example.com/phpmyadmin, then you probably need to edit httpd.conf to allow overrides in the web directory, e.g.:
sudo nano /etc/httpd/conf/httpd.conf
- Find
<Directory "/var/www/html">
- Replace
AllowOverride none
withAllowOverride all
- Save changes and exit
-
Restart Apache server
sudo service httpd restart
Solution 5
I don't have permissions to comment, so as a separate answer.
1) Check what LINUX you have
rpm -q centos-release
lsb_release -a
uname -m
2) Check the correct rpm distribution release for you
http://pkgs.repoforge.org/rpmforge-release/
3) Add that distribution
wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
sudo rpm -Uvh rpmforge-release-0.3.6-1.el5.rf.i386.rpm
4) Install the application
sudo yum install phpmyadmin
ln -s /usr/share/phpmyadmin/ /var/www/html/phpmyadmin
vim /usr/share/phpmyadmin/config.inc.php
5) Create permissions to MySQL if necessary (replace pmapass with your own password!)
GRANT USAGE ON mysql.* TO 'pma'@'localhost' IDENTIFIED BY 'pmapass';
GRANT SELECT (
Host, User, Select_priv, Insert_priv, Update_priv, Delete_priv,
Create_priv, Drop_priv, Reload_priv, Shutdown_priv, Process_priv,
File_priv, Grant_priv, References_priv, Index_priv, Alter_priv,
Show_db_priv, Super_priv, Create_tmp_table_priv, Lock_tables_priv,
Execute_priv, Repl_slave_priv, Repl_client_priv
) ON mysql.user TO 'pma'@'localhost';
GRANT SELECT ON mysql.db TO 'pma'@'localhost';
GRANT SELECT ON mysql.host TO 'pma'@'localhost';
GRANT SELECT (Host, Db, User, Table_name, Table_priv, Column_priv)
ON mysql.tables_priv TO 'pma'@'localhost';
Milkncookiez
Updated on September 18, 2022Comments
-
Milkncookiez over 1 year
1452 Cannot add or update a child row: a foreign key constraint fails (`bpr`.`trips`, CONSTRAINT `trips_driver_user_id_foreign` FOREIGN KEY (`driver_user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE)
is the error.
Adding a row, manually, through MySQL works fine. If I do it through my application - nope.
The
id
that I am trying to insert is correct (it exists and is an integer). I checked the foreign keys and stuff, everything looks fine. I don't know what the problem might be...Some code:
$input = Input::all(); Trip::create([ 'route_from' => $input['route_from'], 'route_to' => $input['route_to'], ... adding other stuff ... 'driver_user_id' => Auth::user()->id ]);
When I
var_dump(Auth::user()->id)
I do get correctint
number, which is the correctly corresponding ID of the certain user.in the Trip model:
protected $hidden = [ 'id' ]; protected $fillable = [ 'route_from', 'route_to', ... 'driver_user_id' ]; public function Trip() { return $this->belongsTo('User', 'driver_user_id', 'id'); }
in the User model:
public function Trips() { return $this->hasMany('Trip'); }
-
Admin about 9 yearsCan we see code? Or what framework you're using etc, just a little more info
-
Milkncookiez about 9 years@IkoTikashi - done. :)
-
Admin about 9 yearsTake a look here, hope it helps: stackoverflow.com/questions/20705539/…
-
Milkncookiez about 9 years@IkoTikashi - This does not really help me. I already have the row of the certain user, created in the DB, before trying to insert the row for trip and link it to a user. Otherwise I wouldn't be able to get its
id
fromAuth::
. -
Admin about 9 yearsSorry, should've read more thoroughly. I can't help you here, sorry :(
-
-
David almost 13 yearsCan you provide more clarification? How do I go about enabling EPEL?
-
David almost 13 yearsThat looks way too difficult just to install phpMyAdmin. See my answer for a better solution.
-
David over 11 yearsI tried
yum
and can't get it to work.EPEL
is too difficult. -
TJSoler over 11 yearsWhat's too difficult? If you don't want to edit the config and want to keep the server as-is, just use
sudo yum --enablerepo=epel install whateveryouwant
at least on the ec2 machine i'm working (with the amazon base distribution) that works. -
Tuanderful over 11 yearsI don't think it gets any easier than this. The tl;dr? Just copy and pasted
yum --enablerepo=epel install phpmyadmin
-
Nick F almost 11 yearsThe question specifically says that
apt-get
is not available. -
Eric Brotto almost 11 yearsIt also should be noted that this comes with the advantage of uninstalling via
yum erase phpmyadmin
. -
jchavannes over 10 yearsYou can find the latest version of phpMyAdmin here: http://sourceforge.net/projects/phpmyadmin/files/phpMyAdmin/
-
zhongzhu over 10 yearsthe only additional step I had to take was updating the server host endpoint for my RDS database in /etc/phpMyAdmin/config.inc.php -- changing
$cfg['Servers'][$i]['host'] = 'localhost'
to$cfg['Servers'][$i]['host'] = 'xxx.xxxxxxxxxxxx.us-east-1.rds.amazonaws.com'
-
Happy Coder almost 10 yearsHow can I access it through web browser once installed ?
-
Django Reinhardt over 9 yearsRats. It's all installed. I've created the symbolic link. I've restarted the server but all I get is: You don't have permission to access /phpmyadmin on this server.
-
Nadav Kiani over 9 yearsThere is no need to create the symlink. The package comes with a nice apache alias config. The access is by default restricted to 127.0.0.1. You can easily change the directives to allow access.
-
Milkncookiez about 9 yearsOkay, that worked! Can you elaborate a bit, please, what was the problem with the trip being guarded? Do I necessarily need to
unguard
the wholeTrip
object, because it has theid
field in it.. and it is sensitive data? Could I put thedriver_user_id
field inhidden
, because it's sensitive data? And what was going on in general in this situation? Thanks in advance! -
Luceos about 9 yearsWell you've used $fillable to make attributes accessible (see laravel.com/docs/5.0/eloquent). However knowing from past experience it seems to misbehave. So I always instantiate the object first, unguard, fill, reguard and save.. Also unguarding only seems effective on the current object level.
-
Luceos about 9 yearsUpon further inspection of the code, your object is not totally guarded otherwise a MassAssignmentException. What exact version of laravel are you using?
-
Milkncookiez about 9 yearsI am using 4.2 version.
-
Milkncookiez about 9 yearsI found this: ...if
fillable
is not specified, and the key is not listed in theguarded
property, the framework will assume that the key can be safely mass-assigned. Sound perfectly fine and should be expected, but when we include a property that is not a field of the table, it will cause an error, because the framework will try to insert a data into a column that doesn’t exists. in here: hndr.me/blog/… Was helpful. :) -
Luceos about 9 yearsThat is not related. Could you please post the whole $fillable and $guarded arrays and your table layout? It might be that you are trying to assign a value to a property that is not fillable or is guarded.
-
Pang about 9 yearsFor me, it's
/usr/share/phpMyAdmin
instead of/usr/share/phpmyadmin
. That'sphpMyAdmin
with capitalM
andA
. -
urfusion about 9 yearsnot working for me.You don't have permission to access /phpmyadmin on this server.
-
vsingh over 8 yearsFor permissions fixing follow this stackoverflow.com/questions/23704674/…
-
D.Tate over 8 yearsI guess a downside to this approach though is that you might not get the most up-to-date version. When I yum installed, it gave me phpMyAdmin 4.0.10.12 even though it seems 4.5.4.1 is the latest version (as of right now) . Still a nice approach though, thanks
-
brianlmerritt about 8 yearsI struggled with the config - it was a version of phpmyadmin I had never used, and it kept telling me the passwords were insecure - anyone could change them.
-
Jeremy Moritz almost 8 yearsAfter following all these steps, i'm not seeing phpMyAdmin. where do i find it?
-
Mo Beigi about 7 yearsSee if this helps if you have an empty mywebsite.com/phpmyadmin: stackoverflow.com/a/29354629/1800854
-
digout almost 6 years/etc/httpd/conf.d/phpMyAdmin.conf is not there. System wide search couldn't find it
-
Typel over 5 yearsRather than cluttering up your web dir with a symbolic link, another way would be to create a
phpmyadmin.conf
file in your Apache's conf.d directory and add an Alias, such asAlias /phpMyAdmin /usr/share/phpMyAdmin
... Also, I'll note that this method doesn't work with the php7 line, the epel repo lists php56 as a dependency, even though phpmyadmin currently supports versions 5.5 to 7.2 -
Buttle Butkus about 3 yearsDoesn't work for me on Amazon Linux 2. It seems there are 2 dependencies missing for
php-tidy
.Package: php-tidy-5.4.16-9.el7.aarch64 (epel) Requires: php(api) = 20100412-64 Installed: php-common-8.0.2-1.amzn2.aarch64 (@amzn2extra-php8.0)'. Also
Requires: php(zend-abi) = 20100525-64 Installed: php-common-8.0.2-1.amzn2.aarch64 (@amzn2extra-php8.0)`. I tried "skip-broken", but then got a bunch more dependency problems.