mysql basics

Install mysql on ubuntu linux
sudo apt-get install mysql-server
sudo apt-get install php5-mysql

mysql> show databases;

change mysql password
mysql> set password = password 'mypassword'

To assign a password from the command line, use the mysqladmin command:
shell> mysqladmin -u user_name -h host_name password "newpwd"

Login mysql
mysql -u root -p
Password: YOUR PASS

Start MySQL server by using the command:
sudo /etc/init.d/mysql start

Stop MySQL server by using the command:
sudo /etc/init.d/mysql stop

PHPmyadmin
Just use phpmyadmin to administer your mysql database
sudo apt-get install phpmyadmin
Create password for mysql user root
sudo mysqladmin -u root password YOURMYSQLROOTPASSWORD
After doing that phpMyAdmin should be installed at http://localhost/phpmyadmin/
Login to phpmyadmin
user root
password YOURMYSQLROOTPASSWORD

sudo apt-get install mysql-server
(it should ask a password for mysql user ‘root')
--> sudo start mysql
--> mysql -u root -p
within the mysql shell:
--> create user your_username identified by ‘your_pwd';
--> GRANT ALL PRIVILEGES on *.* TO your_username@'%' identified by ‘your_pwd';
--> flush privileges;
(you may have to add yourself to the ‘mysql' group in the Users & Groups admin utility.)
--> mysql -u your_username -p
--> create database db;
** Now, whenever you want to use it:
--> sudo start mysql;
--> mysql -u your_username -p db;
--> create table … ;
--> select * from table … ;

Mysql basics
https://help.ubuntu.com/9.10/serverguide/C/mysql.html

PHPmyadmin
https://help.ubuntu.com/9.10/serverguide/C/phpmyadmin.html

Create new user and privileges
GRANT ALL PRIVILEGES ON *.* TO 'user'@'remote_ip_address' IDENTIFIED BY 'Password' WITH GRANT OPTION;
FLUSH PRIVILEGES;
exit;

mysql> GRANT ALL PRIVILEGES on dbnaam.* TO 'username'@'localhost' identified by 'password';

 

No Comments

Geef een reactie

Het e-mailadres wordt niet gepubliceerd. Vereiste velden zijn gemarkeerd met *