Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'
- IDENTIFIED BY 'your_pass'
- WITH GRANT OPTION;
- sudo ufw allow 3306/tcp
- sudo service ufw restart
- [mysqld]
- bind-address= your-server-ip-address
- #skip-networking
- <?php
- $dbname = 'dbname';
- $dbuser = 'db_user';
- $dbpass = 'db_pass';
- $dbhost = 'your-server-ip-address';
- try {
- $connection = new PDO("mysql:host=$dbhost;dbname=$dbname", $dbuser,
- $dbpass);
- $connection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
- echo "Connected successfully";
- }
- catch(PDOException $e)
- {
- echo "Connection failed: " . $e->getMessage();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement