How To Install Phpmyadmin On Kali Linux
Installing and configuring MySQL and phpMyAdmin on Kali Linux
Table of contents
1. What is MySQL for
ii. MySQL client and server
3. Installing MySQL on Kali Linux
4. Kali Linux replaced MySQL with MariaDB
5. Setting up MySQL on Kali Linux
six. Starting and enabling MySQL autorun
7. Setting and changing the MySQL password. Reset forgotten MySQL/MariaDB password
viii. How to connect to MySQL server
9. How to change MySQL user countersign in Kali Linux
ten. No password and empty MySQL password
eleven. How to install phpMyAdmin on Kali Linux
12. How to modify phpMyAdmin URL
13. Error "Login without a password is forbidden by configuration (meet AllowNoPassword)"
14. How to use phpMyAdmin on Kali Linux
fifteen. phpMyAdmin alternative
16. Additional MySQL Resources
What is MySQL for
MySQL is a database direction system that allows yous to create, store, modify databases. Information technology is often used in conjunction with PHP to store website databases. It can likewise be used equally a data store for any program or tool.
phpMyAdmin is a web application written in PHP that is a graphical interface for MySQL that allows you lot to work with data, including viewing, modifying, importing and exporting data in a web interface. phpMyAdmin requires a web server (Apache), equally well as PHP and MySQL.
This tutorial volition help you better sympathize MySQL and employ it to work with databases. We will also install and configure phpMyAdmin to get a graphical database direction interface. Using this cognition, yous can, for example, run a site on a local figurer, deploy a site using a database from a backup.
MySQL customer and server
MySQL has 2 primary components: server and client.
The MySQL server is the DBMS that powers the databases. The server is required for the database to work.
MySQL client is a utility for connecting to a server. The customer is needed if you want to connect to the MySQL server on the command line.
Installing MySQL on Kali Linux
If you have already worked with Debian derivatives (Linux Mint, Ubuntu), so there are ii packages in them:
- mysql-server - MySQL server
- mysql-customer - MySQL client
Past default, MySQL is already preinstalled in Kali Linux, but if you lot have a minimal build, then you may demand to install the DBMS manually. If y'all try to install the mysql-server package, you lot will receive the post-obit error:
Bundle mysql-server is not available, but is referred to past another package. This may mean that the package is missing, has been obsoleted, or is only bachelor from another source E: Package 'mysql-server' has no installation candidate
The fact is that in Kali Linux (and manifestly in fresh Debian, as well equally in all its derivatives), this parcel is called differently:
- default-mysql-server (DBMS executables and system database setup)
- default-mysql-server-core (simply DBMS executables)
Therefore, apply the following command to install MySQL:
sudo apt install default-mysql-server
Kali Linux replaced MySQL with MariaDB
We say MySQL, but MySQL is completely absent from the Kali Linux repositories. Regardless of whether this DBMS was preinstalled on your system or you lot installed information technology manually, MariaDB is installed instead.
Y'all can verify this yourself with the command:
apt show default-mysql-server
Over again, MySQL is absent in the Kali Linux repositories, and if you need exactly MySQL, and not MariaDB, so you will have to decide this either by connecting an additional repository, or by manually installing the downloaded file.
MariaDB is also a database management organization. Information technology is forked from MySQL. MariaDB's job is to perform all the functions of MySQL, merely to be meliorate. The service proper name, the name of the configuration files have not changed. But out of habit, I volition continue to say "MySQL" in this tutorial, but nosotros will work exclusively with MariaDB.
Setting up MySQL on Kali Linux
MySQL config files:
- /etc/mysql/my.cnf (link to /etc/alternatives/my.cnf)
- /etc/mysql/debian.cnf (obsolete file will be removed in hereafter versions)
- /etc/mysql/conf.d/mysql.cnf
- /etc/mysql/conf.d/mysqldump.cnf
- /etc/mysql/mariadb.conf.d/fifty-client.cnf
- /etc/mysql/mariadb.conf.d/50-mysqld_safe.cnf
- /etc/mysql/mariadb.conf.d/60-galera.cnf
- /etc/mysql/mariadb.conf.d/50-mysql-clients.cnf
- /etc/mysql/mariadb.conf.d/50-server.cnf
Well-nigh of the settings are collected in the fifty-server.cnf file. By default, the MySQL service listens for incoming connections only on localhost (connections from other computers are not possible).
Starting and enabling MySQL autorun
To showtime the service, run the control:
sudo systemctl start mysql
By default, all network services are disabled from autostart, see the article "Configuring and starting network services on Kali Linux (Apache, MySQL, SSH, PostgreSQL, NetworkManager and Bluetooth)" for details.
To enable MySQL autorun every time you turn on your computer, run the command:
sudo systemctl enable mysql
Setting and changing the MySQL password. Reset forgotten MySQL/MariaDB password
For a newly installed MySQL, the root password is empty. To change information technology, run and follow the instructions:
sudo mysql_secure_installation
For a detailed description of the steps and translation of instructions, run across the article "What is the MySQL root password in Kali Linux. How to alter/reset MySQL root countersign in Kali Linux". In the aforementioned article, run across how to reset your countersign if you've forgotten it.
How to connect to MySQL server
When the MySQL server service is running, yous need to use a command similar this to connect to it:
mysql -u USER -p -h HOST
All iii arguments are optional.
If the -u option is omitted, the current OS username volition exist used as the MySQL username.
The -p option means that you lot are logged in with a password. After this selection, y'all do not demand to write a password - it will be requested at the command line prompt.
If yous practise non specify the -h option, then an attempt will be fabricated to connect to the local server.
Attempting to connect when no user password is set:
mysql -u root
This will throw an fault:
ERROR 1698 (28000): Access denied for user 'root'@'localhost'
The essence of the trouble is that unix_socket authentication is used by default, that is, when the Bone username coincides with the username in MySQL/MariaDB, then the countersign does not need to be entered at all. But other users cannot log in as another user, so you need to use sudo to log in as root. See the article "Password and unix_socket authentication in MySQL and MariaDB" for details.
You can choose one of the options:
ane. Always employ sudo:
mysql -u root
2. Make changes to the MySQL settings so that ordinary users can connect to the DBMS.
3. Create a new MySQL user. If this is a user with the same name as your name in the OS, so you tin use unix_socket authentication and not enter a password when connecting. Alternatively, you tin can choose password authentication and utilize whatsoever name.
To access the MariaDB database equally a regular user without using sudo privileges (this volition also set up the root user password), go to the MySQL command line prompt
sudo mysql
and run the following SQL commands:
use mysql; Modify USER 'root'@'localhost' IDENTIFIED Past 'PASSWORD'; exit
Please annotation that you need to enter the PASSWORD.
Then endeavour logging into the database without sudo as shown below.
mysql -u root -p
How to change MySQL user password in Kali Linux
The method shown above was used to change the authentication types, but it tin also be used to modify the password.
Go to the MySQL command line prompt (use either sudo or the -u choice to log in as root):
mysql -u root -p
and run the following commands:
use mysql; Modify USER 'root'@'localhost' IDENTIFIED Past 'NEW PASSWORD'; exit
Delight note that you lot need to enter a NEW PASSWORD.
Likewise annotation that this method changes the root user's countersign. If yous desire to alter the password of another MySQL user, and so in the previous SQL query specify the name of this user, for example:
Modify USER 'USER'@'localhost' IDENTIFIED Past 'NEW Countersign';
No password and empty MySQL password
If y'all piece of work exclusively on localhost and yous exercise not intendance nearly security problems, then for convenience you can prepare an empty countersign (do not do this if you do not fully understand the possible risks):
Modify USER 'root'@'localhost' IDENTIFIED BY '';
In this case, when connecting, you do not demand to use the -p option:
mysql -u root
How to install phpMyAdmin on Kali Linux
Past default phpMyAdmin is non installed on Kali Linux.
Installation tin can exist done in ii means:
- Since phpMyAdmin is a PHP web application, you can simply download the archive with the source lawmaking (scripts) and unpack it to whatever folder on the server.
- Near distributions have a phpMyAdmin installation parcel in the standard repositories. The reward of this approach is that you do not need to keep track of new phpMyAdmin releases and do transmission updates.
I prefer to install phpMyAdmin from the standard repositories (while WordPress, on the contrary, I adopt to install past simply copying the folder with the WordPress files to the web server folder; thank you to this I control the update process; if you really demand to update, and so all this is washed in the user-friendly web interface of WordPress itself).
You should already have Apache, MySQL, PHP installed. By default, they are already available in Kali Linux, but if you lot have a version with a minimum number of packages, then install them:
sudo apt install apache2 default-mysql-server php
Install phpMyAdmin with the post-obit command:
sudo apt install phpmyadmin
Answer No to the configuration prompt with dbconfig-common:
Use the Tab fundamental to movement between items and Enter to press.
Select "apache2".
Use the Space primal to select items, use the Tab fundamental to move between items, and press Enter to cease.
Now, after enabling the web server, phpMyAdmin will be available athttp://your_server_IP/phpmyadmin/
And for a local server at http://localhost/phpmyadmin/
Don't forget to start the services:
sudo systemctl offset apache2 sudo systemctl start mysql
At the bottom of the phpMyAdmin page, y'all can see the messages with a carmine background:
The phpMyAdmin configuration storage is not completely configured, some extended features take been deactivated. Find out why. Or alternately become to 'Operations' tab of whatsoever database to set it up there.
If you only desire to enable them, so follow the link http://localhost/phpmyadmin/chk_rel.php and click "Create Database".
Afterwards that, all new functions will be activated.
How to change phpMyAdmin URL. How to enable and disable phpMyAdmin
If during the installation of phpMyAdmin you chose not to configure information technology for employ with the Apache web server, use the command to enable phpMyAdmin:
sudo ln -s /etc/phpmyadmin/apache.conf /etc/apache2/conf-enabled/
Restart the spider web server for the changes to take effect.
To disable phpMyAdmin apply the control:
sudo rm /etc/apache2/conf-enabled/phpmyadmin.conf
Restart the web server for the changes to take result.
There is an important line in the /etc/phpmyadmin/apache.conf file:
Alias /phpmyadmin /usr/share/phpmyadmin
Its essence is that the URL /phpmyadmin (for example, http://localhost/phpmyadmin) begins to represent to the /usr/share/phpmyadmin folder. That is, the phpMyAdmin files (scripts) are physically located in /usr/share/phpmyadmin, and not in the web server directory (for example, /var/www/html/).
Many automated scanners of "hidden" files and folders of the spider web server and sites must bank check the directories "phpmyadmin", "pma" and others like that. You tin can hide your phpMyAdmin nicely by changing the Alias. For example:
Alias /lkjgler94345 /usr/share/phpmyadmin
PhpMyAdmin will at present be available at http://localhost/lkjgler94345 - non easy to find.
Error "Login without a password is forbidden by configuration (see AllowNoPassword)"
When you try to log into phpMyAdmin with a blank password, you may receive an error:
Login without a password is forbidden past configuration (see AllowNoPassword)
The lesser line is that login as root or some other user without a countersign is prohibited past the phpMyAdmin configuration.
Two means to gear up it:
- ready MySQL countersign
- let passwordless login in phpMyAdmin config
To enable passwordless login in phpMyAdmin, open up the /etc/phpmyadmin/config.inc.php file:
sudo gedit /etc/phpmyadmin/config.inc.php
Find the 2nd (in that location are 2) line:
// $cfg['Servers'][$i]['AllowNoPassword'] = TRUE;
uncomment it to get:
$cfg['Servers'][$i]['AllowNoPassword'] = TRUE;
Save and close the config.inc.php file.
How to use phpMyAdmin on Kali Linux
Working in phpMyAdmin is intuitive, so at that place shouldn't be any difficulties.
But by default PHP has very pocket-sized limits on the size of the processed file, so if you import or export a large database, you may encounter phpMyAdmin's "Incorrect format parameter". The mistake occurs due to PHP restrictions on the size of uploaded files and files transferred by the POST method.
It is necessary to increase the value of these 2 variables in the php.ini (to find information technology locate php.ini) configuration file. Open the php.ini file and set a larger value for the following variables:
upload_max_filesize=64M post_max_size=64M
By default, the values there are:
upload_max_filesize = 2M post_max_size = 8M
Of course, this is besides little for almost any task.
Restart the web server for the changes to take consequence.
If you work a lot with phpMyAdmin, then you can customize it for yourself, including setting default settings for import and consign. An instance of how to practice this in the commodity "How to alter default export settings in phpMyAdmin".
phpMyAdmin alternative
Annotation that phpMyAdmin is a shim that uses PHP to dispense databases. Therefore, there is a loss in speed when processing very large databases, and y'all can also encounter the PHP limits set in its configuration file.
Importing and exporting large databases into MySQL can be performed using MySQL itself - auxiliary utilities are supplied with the DBMS that allow y'all to perform diverse deportment. To export databases, you can employ mysqldump utility.
To export a database, use the following command
mysqldump -u username -p database_name > data-dump.sql
Where:
- username is the username with which you can log into the database
- database_name is the name of the database to export
- data-dump.sql is a file in the electric current directory where the output will be saved
Database import
To import an existing database file into MySQL or MariaDB, you demand to create a new database into which the contents of the dump file will be imported.
Outset past logging into the database as root or some other user with sufficient privileges to create a new database.
mysql -u root -p
This will give you a prompt to the MySQL shell. Side by side, create a new database called new_database.
CREATE DATABASE new_database;
A confirmation volition be displayed most creation.
Output Query OK, ane row affected (0.00 sec)
Now exit the MySQL shell past pressing CTRL+D. On a regular command line, you tin import the file with the following command:
mysql -u username -p new_database < information-dump.sql
Where:
- username is the username with which you can log into the database
- newdatabase is the name of the newly created database
- data-dump.sql - dump file with data for import located in the electric current directory
Successful execution of the command will not brandish whatever letters. If errors occur during this procedure, mysql will impress them in the concluding. Y'all tin verify that the database has been imported past logging into the MySQL beat out once again and analyzing the information. This can be done by selecting a new database with the control
Use new_database
and then transport a SQL query:
Show TABLES;
or a similar command to view the data.
How do I backup multiple MySQL databases?
If you desire to support multiple databases, run the post-obit command. The post-obit example will fill-in the structure and data of the rsyslog, syslog databases into a single file called rsyslog_syslog.sql.
mysqldump -u root -p --databases rsyslog syslog > rsyslog_syslog.sql
How do I support all databases?
If you desire to support all databases, then employ the post-obit command with the --all-database pick. The following command volition support all databases, their structure and information, to a file called all-databases.sql.
mysqldump -u root -ptecmint --all-databases > all-databases.sql
How to backup only the MySQL database construction?
If you want to brand a backup copy of the database structure without information, then employ the --no-data selection in the control. The following command will consign the rsyslog database structure to the rsyslog_structure.sql file.
mysqldump -u root -p --no-data rsyslog > rsyslog_structure.sql
How to backup merely information from MySQL database?
To create a backup of only information from a database without a structure, use the --no-create-info choice with the command. This command will take data from the rsyslog database and re-create it to the rsyslog_data.sql file.
mysqldump -u root -p --no-create-db --no-create-info rsyslog > rsyslog_data.sql
How practice I backup one table from a database?
With the next command y'all can make a backup copy of one table or certain tables from your database. For example, the following command will but make a fill-in of the wp_posts table from the wordpress database.
mysqldump -u root -p wordpress wp_posts > wordpress_posts.sql
How do I backup multiple tables?
If y'all want to back up several or specific tables from the database, separate each table with a space.
mysqldump -u root -p wordpress wp_posts wp_comments > wordpress_posts_comments.sql
How practice I back up a remote MySQL database?
The following command will dorsum up the "gallery" database from the remote server 185.117.153.79 to the local server.
mysqldump -h 185.117.153.79 -u root -p gallery > gallery.sql
Yous tin can edit databases, add new records, delete records, etc. from the command line using SQL queries.
Additional MySQL Resources
You may also exist interested in the following articles:
- Configuring and starting network services on Kali Linux (Apache, MySQL, SSH, PostgreSQL, NetworkManager and Bluetooth)
- Basics of working with a web server for a pentester
- What is the MySQL root password in Kali Linux. How to change/reset MySQL root password in Kali Linux
- Default passwords in Kali Linux
- Password and unix_socket authentication in MySQL and MariaDB. Error "#1698 - Access denied for user 'root'@'localhost'" (SOLVED)
Source: https://miloserdov.org/?p=5910
Posted by: reesebothe1945.blogspot.com
0 Response to "How To Install Phpmyadmin On Kali Linux"
Post a Comment