数据库 
首页 > 数据库 > 浏览文章

Linux(Ubuntu)下Mysql5.6.28安装配置方法图文教程

(编辑:jimmy 日期: 2024/11/16 浏览:3 次 )

mysql5.6.28安装配置方法

1.系统基本信息查看,尝试yum安装

$ sudo -s
# df -lh
Filesystem  Size Used Avail Use% Mounted on
/dev/vda1  79G 1.6G 74G 3% /
udev   3.9G 8.0K 3.9G 1% /dev
tmpfs   799M 252K 799M 1% /run
none   5.0M  0 5.0M 0% /run/lock
none   3.9G  0 3.9G 0% /run/shm
# uname -a
Linux nj01 3.16.0-34-generic #47~14.04.1-Ubuntu SMP Fri Apr 10 17:49:16 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

# rpm -qa|grep yum
The program 'rpm' is currently not installed. You can install it by typing:
apt-get install rpm
# apt-get install rpm
……
# rpm -qa|grep yum
# yum install 
The program 'yum' is currently not installed. You can install it by typing:
apt-get install yum
# apt-get install yum
……
# yum install mysql
Setting up Install Process
No package mysql available.
Nothing to do

2.更换安装方式

# apt-get install mysql-server
Reading package lists... Done
Building dependency tree      
Reading state information... Done
The following extra packages will be installed:
  libdbd-mysql-perl libdbi-perl libhtml-template-perl libmysqlclient18 libnet-daemon-perl libplrpc-perl libterm-readkey-perl mysql-client-5.5
  mysql-client-core-5.5 mysql-common mysql-server-5.5 mysql-server-core-5.5
Suggested packages:
  libipc-sharedcache-perl tinyca mailx
The following NEW packages will be installed:
  libdbd-mysql-perl libdbi-perl libhtml-template-perl libmysqlclient18 libnet-daemon-perl libplrpc-perl libterm-readkey-perl mysql-client-5.5
  mysql-client-core-5.5 mysql-common mysql-server mysql-server-5.5 mysql-server-core-5.5
0 upgraded, 13 newly installed, 0 to remove and 15 not upgraded.
Need to get 27.6 MB of archives.
After this operation, 98.2 MB of additional disk space will be used.
Do you want to continue [Y/n]"htmlcode">

mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' identified by '******';
Query OK, 0 rows affected (0.00 sec)

mysql> 
mysql> 
mysql> 
mysql> 
mysql> 
mysql> create database testdb;
Query OK, 1 row affected (0.01 sec)

mysql> 
mysql> 
mysql> 
mysql> 
mysql> show databases;
+--------------------+
| Database   |
+--------------------+
| information_schema |
| mysql    |
| testdb    |
| performance_schema |
+--------------------+
4 rows in set (0.00 sec)

mysql> insert into mysql.user(Host,User,Password) values("%","test",password("******"));
Query OK, 1 row affected, 3 warnings (0.00 sec)

mysql> 
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> GRANT ALL PRIVILEGES ON testdb.* TO 'test'@'% identified by '******';
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

4.问题解决

(1)访问报错,网络连接报错:10038 ,telnet 不通
S1.关闭防火墙 # ufw allow 3306 ,还是不行
S2.用户网络权限已经给了(rant all privileges on . to ‘root'@'%' identified by ‘youpassword' with grant option;)
S3.查看网路信息 # netstat -ano
tcp 0 0 127.0.0.1:3306
应该是绑定IP问题,修改/etc/MySQL/my.conf
找到bind-address = 127.0.0.1这一行
改为bind-address = 0.0.0.0,问题解决。
(2)表区分大小写:
用root帐号登录后,在/etc/my.cnf 中的[mysqld]后添加添加lower_case_table_names=1,重启MYSQL服务,这时已设置成功:不区分表名的大小写;
lower_case_table_names参数详解:
lower_case_table_names = 0
其中 0:区分大小写,1:不区分大小写

5.基本服务命令

# 启动MySQL$ sudo service mysql start 
# 关闭MySQL$ sudo service mysql stop
# 重启MySQL$ sudo service mysql restart
# 其他命令:$ sudo /etc/init.d/mysql start
$ sudo /etc/init.d/mysql stop
$ sudo /etc/init.d/mysql restart

6.卸载Mysql:

sudo apt-get autoremove mysql* --purge
sudo apt-get remove apparmor
sudo apt-get install mysql-server mysql-common

卸载后删除mysql相关文件(/var/lib/mysql , /etc/mysql等等,可以用 find -name mysql 查询下相关路径)

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。

上一篇:Linux安装MySQL5.6.24使用文字说明
下一篇:mysql 5.7.17 免安装版配置方法图文教程(windows10)
一句话新闻
微软与英特尔等合作伙伴联合定义“AI PC”:键盘需配有Copilot物理按键
几个月来,英特尔、微软、AMD和其它厂商都在共同推动“AI PC”的想法,朝着更多的AI功能迈进。在近日,英特尔在台北举行的开发者活动中,也宣布了关于AI PC加速计划、新的PC开发者计划和独立硬件供应商计划。
在此次发布会上,英特尔还发布了全新的全新的酷睿Ultra Meteor Lake NUC开发套件,以及联合微软等合作伙伴联合定义“AI PC”的定义标准。