The best solution is to create a new user for PhpMyAdmin (or use the existing one if it was created during install) and grant it the required privileges.
CREATE USER 'phpmyadmin'@'localhost' IDENTIFIED BY '<New-Password-Here>';
GRANT ALL PRIVILEGES ON *.* TO 'phpmyadmin'@'localhost' WITH GRANT OPTION;
FLUSH PRIVILEGES;
Use this user anywhere you want “root” access.
- Open your terminal
sudo mysql -u rootuse mysql;SELECT user, plugin FROM user;UPDATE user SET plugin = "mysql_native_password" WHERE user = "root" ;SELECT user, plugin FROM user;exitservice mysql restart
mysql –user=root –password=mypass
mysql -u user -ppassword
password should not have any space with -p
REVIEW
How to Install LAMP stack on Ubuntu
Installing the popular open-source software on your computer
A LAMP Stack is a set of open-source software that can be used to create websites and web applications. LAMP is an acronym: these stacks typically consist of the Linux operating system, the Apache HTTP Server, the MySQL relational database management system, and the PHP programming language.
To install LAMP on your computer follow these steps.
Step 1: Update your system
sudo apt-get update
Step 2: Install Mysql
sudo apt-get install mysql-server mysql-client libmysqlclient-dev
Step 3: Install Apache server
sudo apt-get install apache2 apache2-doc apache2-npm-prefork apache2-utils libexpat1 ssl-cert
Step 4: Install PHP (php8.1 latest version of PHP)
sudo apt-get install libapache2-mod-php8.1 php8.1 php8.1-common php8.1-curl php8.1-dev php8.1-gd php-pear php-imagick php8.1-mcrypt php8.1-mysql php8.1-ps php8.1-xsl
Step 5: Install Phpmyadmin(for database)
sudo apt-get install phpmyadmin
tasksel
Install PHP mcrypt extension on Ubuntu
$ sudo apt update
$ sudo apt install php-mcrypt
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package php-mcrypt is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'php-mcrypt' has no installation candidate
sudo apt update
sudo apt install -y build-essential
$gcc --version
gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ make --version
GNU Make 4.2.1
Built for x86_64-pc-linux-gnu
Copyright (C) 1988-2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
sudo apt install php php-pear php-dev libmcrypt-dev
$ which pecl
/usr/bin/pecl
PECL usage:
$ pecl help
Commands:
build Build an Extension From C Source
bundle Unpacks a Pecl Package
channel-add Add a Channel
channel-alias Specify an alias to a channel name
channel-delete Remove a Channel From the List
channel-discover Initialize a Channel from its server
channel-info Retrieve Information on a Channel
channel-login Connects and authenticates to remote channel server
channel-logout Logs out from the remote channel server
channel-update Update an Existing Channel
clear-cache Clear Web Services Cache
config-create Create a Default configuration file
config-get Show One Setting
config-help Show Information About Setting
config-set Change Setting
config-show Show All Settings
convert Convert a package.xml 1.0 to package.xml 2.0 format
cvsdiff Run a "cvs diff" for all files in a package
cvstag Set CVS Release Tag
download Download Package
download-all Downloads each available package from the default channel
info Display information about a package
install Install Package
list List Installed Packages In The Default Channel
list-all List All Packages
list-channels List Available Channels
list-files List Files In Installed Package
list-upgrades List Available Upgrades
login Connects and authenticates to remote server [Deprecated in favor of channel-login]
logout Logs out from the remote server [Deprecated in favor of channel-logout]
makerpm Builds an RPM spec file from a PEAR package
package Build Package
package-dependencies Show package dependencies
package-validate Validate Package Consistency
pickle Build PECL Package
remote-info Information About Remote Packages
remote-list List Remote Packages
run-scripts Run Post-Install Scripts bundled with a package
run-tests Run Regression Tests
search Search remote package database
shell-test Shell Script Test
sign Sign a package distribution file
svntag Set SVN Release Tag
uninstall Un-install Package
update-channels Update the Channel List
upgrade Upgrade Package
upgrade-all Upgrade All Packages [Deprecated in favor of calling upgrade with no parameters]
Usage: pecl [options] command [command-options] <parameters>
Type "pecl help options" to list all options.
Type "pecl help shortcuts" to list all command shortcuts.
Type "pecl help version" or "pecl version" to list version information.
Type "pecl help <command>" to get the help for the specified command.
$sudo pecl channel-update pecl.php.net
Updating channel "pecl.php.net"
Update of Channel "pecl.php.net" succeeded
$ sudo pecl update-channels
Updating channel "doc.php.net"
Update of Channel "doc.php.net" succeeded
Updating channel "pear.php.net"
Update of Channel "pear.php.net" succeeded
Updating channel "pecl.php.net"
Channel "pecl.php.net" is up to date
Let’s search for mcrypt extension.
$ sudo pecl search mcrypt
Matched packages, channel pecl.php.net:
=======================================
Package Stable/(Latest) Local
mcrypt 1.0.4 (stable) Bindings for the libmcrypt library
mcrypt_filter 0.1.0 (beta) Applies mcrypt symmetric encryption using stream filters
You can the install mcrypt extension using pecl command with install option.
$ sudo pecl install mcrypt
downloading mcrypt-1.0.4.tgz ...
Starting to download mcrypt-1.0.4.tgz (27,056 bytes)
.........done: 27,056 bytes
6 source files, building
running: phpize
Configuring for:
PHP Api Version: 20190902
Zend Module Api No: 20190902
Zend Extension Api No: 320190902
........
When you see a prompt
libmcrypt prefix? [autodetect] :
Press Enter to autodetect.
You should get an output like below for completed installation of mcrypt extension on Ubuntu Linux machine.
Build process completed successfully
Installing '/usr/lib/php/20190902/mcrypt.so'
install ok: channel://pecl.php.net/mcrypt-1.0.4
configuration option "php_ini" is not set to php.ini location
You should add "extension=mcrypt.so" to php.ini
Enable extension in php.ini file. You can use nano or vim editor:
$ sudo vim /etc/php/*/cli/php.ini
extension=mcrypt.so
$ sudo vim /etc/php/*/apache2/php.ini
extension=mcrypt.so
You can confirm that the module was installed and enabled with the command:
$ php -m | grep mcrypt
mcrypt
### Restart Apache web server ###
sudo systemctl restart apache2
### Restart nginx web server ###
sudo systemctl restart nginx
Sharing is caring
Share
+1
Tweet
Share
Share