How to use mysql?
来源:互联网 发布:什么是观测数据 编辑:程序博客网 时间:2024/05/22 00:51
How to use mysql?
How to install mysql?
My computer is in ubuntu :linux deepin 3.2.0-26-generic.
In any dictionary,type:sudo apt-get install mysql-server
it will run automantically.usually ,it will pop a window to ask you to input a password for root
user.
if you failure in install because last install failure,it will print a message like this:
Unable to set password for the Mysql "root" userAn error occurred while setting password for the mysqlThis may have happened because the account already has a password, or because of a communication problem with the Mysql server.You should check the account's password after the package installation.Please read the /usr/share/doc/mysql-server-5.5/README.Debian file for more information.
So you should remove last falure install like these:
sudo dpkg --purge mysql-client-core-5.5 # or alternative versionsudo dpkg --purge mysql-clientsudo dpkg --purge mysql-server-core-5.5 # or alternative versionsudo dpkg --purge mysql-common
Basically I just type
sudo dpkg --purge mysql # followed by two tabs
Then –purge any packages the terminal auto-completes. Purge mysql-common at last because of some dependency problems.
Use above dpkg commands in addition to
sudo apt-get --purge remove mysql-serversudo apt-get --purge remove mysql-clientsudo apt-get --purge remove mysql-commonsudo apt-get autoremovesudo apt-get autoclean
Also I tried Greq’s method
sudo rm -rf /etc/mysqlRemove the mysql folder from /var/libsudo rm -rf /var/lib/mysql/At this point, to make sure mysql is fully removed, check withwhich mysqlmysql --version
the last two commond is check if mysql is deleted clean.
and then,you can reinstall mysql by first commond .
How to stop ,start mysql?
sudo /etc/init.d/mysql start(or stop,restart)
How to connect to mysql ?
mysql -u username -p
How to use mysql from other computer?
By default mysql is only can be used in localhost,you can visit it from other computer by do like these:
logging in mysql by :mysql -u root -pgrant all privileges on 你想让这个用户访问的数据库 to username@'ip地址'或者'%'(就不限制ip地址了) identified by 'password'
例子:
mysql> grant all privileges on . to han@’%’ identified by “123456”
mysql>use mysql
mysql> select host ,user,password from user;
+———–+——————+——————————————-+
| host | user | password |
+———–+——————+——————————————-+
| localhost | root | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B |
| deepin | root | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B |
| 127.0.0.1 | root | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B |
| ::1 | root | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B |
| localhost | debian-sys-maint | *4E922998EE5880CD4BDB02EB240F661626F61752 |
| % | han | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 |
+———–+——————+——————————————-+
6 rows in set (0.00 sec)
mysql>
Now you can visit mysql from other computer:
mysql -h mysql所在的机器 -u username -p password
- How to use mysql?
- How To Use MySQL Easily In PHP
- How to use MySql with Linq to SQL
- How To Use DataGird
- how to use typedef
- how to use gz
- How to use chkconfig
- How to use ,,,,
- how to use dialog
- How to use UIDs
- How to use dmalloc
- How to use abld
- How to use BSTR
- How to use Ant
- how to use mstsclib
- how to use gcc
- how to use thread
- how to use ffmpeg
- Netty-SocketIO的Web推送实战应用
- 企业级|Harbor镜像仓库合体Nutanix超融合
- 如何获取Android唯一标识(唯一序列号)
- date命令转换计算机时间
- 单例模式详解
- How to use mysql?
- 基于hbase仿百度的分页显示
- Linux 启动文件、设置环境变量的位置
- java自定义Date工具类,计算年龄
- [机器学习] 聚类算法的轮廓系数,java实现
- windows下修改mysql忘记的密码
- 在浏览器地址栏输入一个URL后回车,执行的全部过程
- uicc详解-4(uicc在UE端的初始化过程)
- 关于.net程序中读取不规则的excle表格中的数据,并插入到数据库的方法