Toggle navigation

MySQL for LNMP/LAMP Image Guide

Version 1.0.0

This is the user guide of  the software image powered by Websoft9.
For more technical support, please go to http://en.websoft9.com/support

NOTE: Use following URL to open phpMyAdmin page:

http://< Public net IP >/phpMyAdmin

phpMyAdmin is an application for MySQL databases management. With it you can create, alter, drop, delete, import and export MySQL database tables. You can also run MySQL queries, optimize, repair and check tables, change collation.

Get database password command:

cd   /root/oneinstack                         
grep dbrootpwd options.conf    

 

default user/password:root/123456      

Method1:
cd /root/oneinstack
./reset_db_root_password.sh

Method2:Edit user table directly with UPDATE
mysql -uroot -p 
mysql> use mysql; 
mysql> update user set password=password(‘newpassword’) where user=’root’; 
mysql> flush privileges;

For example: create a database named ‘dbname1’

mysql -uroot –p #enter mysql console
MySQL [(none)]> create database dbname;               #Notice the semicolon at the end
MySQL [(none)]> show databases;
MySQL [(none)]> exit;                                                     #quit mysql console,Notice the semicolon at the end

MySQL [(none)]> drop database dbname;                        #delete a database
MySQL [(none)]> exit;                                                         #quit mysql console,Notice the semicolon at the end

For security purposes, we usually create a unique database connection account for each web application(Account name can not be root).

E.g:add a user named : db_user,password :db_password,Authorization for the localhost to the dbname database all permissions,the commands are as follows :

# mysql -uroot –p
MySQL [(none)]> grant all privileges on dbname.* to db_user@’localhost’ identified by ‘db_password’;
MySQL [(none)]> flush privileges;
MySQL [(none)]> exit;                                      #quit mysql console,Notice the semicolon at the end

before2

Note:For security reasons, the default allows only the cloud host (localhost) to connect to the database, if you need to remotely connect to the database, the following operations are required.
1、The security group port on the cloud management console opens 3306 ports
2、Open database remote access:http://bbs.websoft9.com/forum.php?mod=viewthread&tid=360