Advertisement
Joeribrinks

createphpmyadminonc9

Sep 11th, 2019
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. create folder: practice
  2.  
  3. create file sample.php: echo'hoi';
  4.  
  5. Bash: wget https://files.phpmyadmin.net/phpMyAdmin/4.8.0.1/phpMyAdmin-4.8.0.1-all-languages.zip
  6.  
  7. unzip the file: unzip phpMyAdmin-4.8.0.1-all-languages.zip
  8.  
  9. Start mysql: sudo service mysqld start
  10.  
  11. Login to root user: mysql -u root -p
  12.  
  13. create password for root user: update mysql.user set password=password('password') where user = 'root';
  14. flush privileges;
  15.  
  16. restart mysql: sudo service mysqld restart
  17.  
  18. create file connection.php and paste this in:
  19. <?php
  20. try {
  21. $dbh = new PDO('mysql:host=localhost;dbname=sample;charset=utf8', 'root', 'password');
  22. foreach($dbh->query('SELECT * from users') as $row) {
  23. print_r($row);
  24. }
  25. $dbh = null;
  26. } catch (PDOException $e) {
  27. print "test: " . $e->getMessage() . "<br/>";
  28. die();
  29. }
  30. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement