MySQL Install In Ubuntu

1.Install MySQL

Unbuntu has provided a convenient way to install MySQL,you just need to scan lower command in the terminal,the unbuntu will help you install MySQL automaticly.

sudo apt install mysql-client-core-5.7   
sudo apt install mariadb-client-core-10.1
sudo apt-get install mysql-server

When you install mysql,system may remind you set initial password,or may not.If in the install processing,it remind you set the password,you just need to set and remeber you password,then you can jump to step2.If you are unlucky like me,you should to change you password in the lower way.

sudo cat /etc/mysql/debian.cnf

 

 As can be see,you My password is : pV3OLBUQffd5ClSO,and then scan lower command in your terminnal,but you should change the "user" and the "password",in the lower command, -u means user,-p means password.and then you can enter you mysql.

mysql -u debian-sys-maint -ppV3OLBUQffd5ClSO

Now you need to change your password and remenber it,for this,lower commands will help you.INn this place my new username is "root" and my password is "root" also.

use mysql;
//here is you new user name and password
update mysql.user set authentication_string=password('root') where user='root' and Host ='localhost';
update user set plugin="mysql_native_password"; 
quit;

Now,you can restart the mysql and login use your new username and password.

sudo service mysql restart
mysql -u root -proot

2.Install mysql-workbench

mysql-workbench is a a nice graphical interface of MySQL in ubuntu,and it's installing method is also easy,after you install mysql-workbench,you will surprise the convenience to use.

sudo apt-get install mysql-workbench
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章