在Ubuntu上安装Mysql

安装mysql server:

1、  sudo apt-get install mysql-server

2、  如果出现Unable to locate package……,执行sudo apt-get update,然后再执行sudo apt-get upgrade,再执行sudo apt-get install mysql-server

3、  进入mysql命令窗口,需要输入mysql  -h localhost –u root –p

4、  接着输入安装时的密码

5、  创建用户CREATE USER 'guo.liang'@'localhost' IDENTIFIED BY '851220';

6、  授权GRANT ALL ON cookbook.* TO 'guo.liang'@'localhost';

 

安装mysql workbench客户端:

1、  sudo apt-get install mysql-client

2、  sudo apt-get install mysql-workbench

 

运行mysql workbench:

1、  whereis mysql-workbench  查找在那个目录

2、  /usr/bin/mysql-workbenth 运行mysql workbench

 


Starting, Stopping and Restarting MySQL on Ubuntu

To start, stop, and restart the MySQL service on Ubuntu, you can use the /etc/init.d/mysql script.

You need to ssh to your Pod as root, or use sudo command. Here are each of the commands:

Start:

root@mypod:~# sudo /etc/init.d/mysql start

Stop:

root@mypod:~# sudo /etc/init.d/mysql stop

Restart:

root@mypod:~# sudo /etc/init.d/mysql restart

 
 

A different way to do this, is to use “upstart” (which is what /etc/init.d/mysql links to) which works as follows:

Start:

root@mypod:~# sudo start mysql

Stop:

root@mypod:~# sudo stop mysql

Restart:

root@mypod:~# sudo restart mysql

posted on 2015-03-13 22:54  LingoLiang  阅读(139)  评论(0编辑  收藏  举报

导航