Labels

Android (1) bash (2) boost (2) C (34) C++ (2) cheatsheet (2) CLion (6) css (3) Debian (33) DL (17) Docker (2) Dreamweaver (2) Eclipse (3) fail2ban (4) git (5) GitHub (4) Hacking (3) html (8) http (1) iOS (1) iPad (1) IRC (1) Java (31) javascript (3) Linux (167) Mac (19) Machine Learning (1) mySQL (48) Netbeans (4) Networking (1) Nexus (1) OpenVMS (6) Oracle (1) Pandas (3) php (16) Postgresql (8) Python (9) raid (1) RedHat (14) Samba (2) Slackware (47) SQL (14) svn (1) tar (1) ThinkPad (1) Virtualbox (3) Visual Basic (1) Visual Studio (1) Windows (2)

Saturday, 29 December 2018

mySQL and phpMyAdmin

https://docs.slackware.com/howtos:databases:install_mysql_on_slackware


See here for a more up to date account of installing Apache, php, mySQL and phpMyAdmin on Debian.

goto www.../phpmyadmin/setup.php and customise install, you must download file and then upload to config.inc.php file located in ../phpmyadmin/
Choose http authentication means any mysql user can login via http authentication.
SEE *** below re authentication


Initialise installation?
mysql_install_db --user=mysql


Change permissions to allow starting/stopping of server (inc' at boot time)
chmod 775 /etc/rc.d/rc.mysqld

To enable networking, comment out the following line in: /etc/rc.d/rc.mysqld
SKIP="--skip-networking"

Start/stop mySQL
/etc/rc.d/rc.mysqld start
/etc/rc.d/rc.mysqld stop

to connect from console:
mysql -u root (where user is root with no password)
OR
mysql -u root -p (where you will be prompted for the password)

List all databases:
show databases;

List all users and permissions:
select * from mysql.user;


OR


SELECT user FROM mysql.user;


SELECT user, host FROM mysql.user;



List of all tables in 'Database Name'

SELECT table_name FROM information_schema.tables WHERE table_schema ='Database Name';




Connect to database with mysql -u root (where user is root with no password)

To create a user:
CREATE USER 'neuser'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON *.* TO 'user'@'localhost' IDENTIFIED BY 'password';
***NOTE:
for access via phpmyadmin, user must be:
'user'@'localhost' and NOT 'user'@'%'


To allow webpage php type stuff to work:
Comment out SKIP="--skip-networking" in /etc/rc.d/rc.mysqld # ENABLE networking.

To create a user:
CREATE USER 'newser'@'%' IDENTIFIED BY 'password';

GRANT ALL PRIVILEGES ON *.* TO 'user'@'%' IDENTIFIED BY 'password';



The following creates a user that can access the database from the network:
 
CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';

GRANT ALL PRIVILEGES ON *.* TO 'username'@'localhost' WITH GRANT OPTION;

CREATE USER 'username'@'%' IDENTIFIED BY 'password';

GRANT ALL PRIVILEGES ON *.* TO 'username'@'%' WITH GRANT OPTION;

FLUSH PRIVILEGES;



To delete a user:
DROP USER 'user'@'localhost'

Some privileges:
ALL PRIVILEGES CREATE DROP DELETE INSERT SELECT UPDATE
last 4 for web client user

To change a user's password;

SET PASSWORD FOR 'user'@'localhost' = PASSWORD('password');

FLUSH PRIVILEGES;

No comments:

Post a Comment

Note: only a member of this blog may post a comment.