linux下关于mysql安装的一些问题
2017-05-04 11:22
411 查看
安装mysql时候找不到密码尝试无果后开始卸载重装
sudo yum update:更新yum软件
yum update -y 不用按确定一直跟新的
rpm -e 软件包:卸载软件包
rpm -e --nodeps:强制卸载
查看mysql的安装情况
rpm -qa | grep -i mysq
卸载:
1.普通卸载(可能有依赖关系)
rpm -e mysql-community-libs-5.7.18-1.el6.x86_64
2.强制卸载
rpm -e --nodeps mysql-community-libs-5.7.18-1.el6.x86_64
删除mysql服务
[root@localhost
local]# chkconfig --list | grep -i mysql
[root@localhost local]# chkconfig --del mysql
在Linux系统下,通过命令“rm -rf”可以将任何数据直接从硬盘删除,并且没有任何提示
删除分散mysql文件夹
[root@localhost local]# whereis mysql 或者 find / -name mysql
mysql: /usr/lib/mysql /usr/share/mysql
清空相关mysql的所有目录以及文件
rm -rf /usr/lib/mysql
rm -rf /usr/share/mysql
rm -rf /usr/my.cnf
下面成功安装mysql服务详细步骤
1.Update your system:
2.Install and Start MySQL
(1)Install MySQL and tell it which runlevels to start on:
(2)Then to start the MySQL server:
3.set password
回车,回车跳过初始密码
设置新的密码
4.登录mysql
In the example below,
the name of the database,
the user, and
the user’s password.
You can shorten this process by creating the user while assigning database permissions:
Then exit MySQL.
use testdb;create table customers (customer_id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, first_name TEXT, last_name TEXT);
重置密码:
If you forget your root MySQL password, it can be flushed and then reset.
Stop the current MySQL server instance, then restart it with an option to not ask for a password.
Reconnect to the MySQL server with the MySQL root account.
Use the following commands to reset root’s password.
Replace
a strong password.
Then restart MySQL.
关于数据库乱码问题:
查看数据库字符集
SHOW VARIABLES LIKE 'character%';
上面是正确的编码
刚开始可能是latint1,全部修改成你需要的编码
#vim /etc/mysql/my.cnf (5.5以前系统)如下修改:
在【client】下面加入 default-character-set=utf8
在【mysqld】下面加入default-character-set=utf8
Notice:注意 如果修改后不能启动报错试试把default-character-set=utf8改为character_set_server=utf8,仅仅加入到mysqld下面的.client就不需要加了
#vim /etc/mysql/my.cnf 。(5.5以后系统)如下修改:
[client]
default-character-set=utf8
[mysqld]
default-storage-engine=INNODB
character-set-server=utf8
collation-server=utf8_general_ci
卸载:参考:http://blog.csdn.net/rosten/article/details/25096159
安装:参考:https://www.linode.com/docs/databases/mysql/how-to-install-mysql-on-centos-6
create database testdb; create user 'testuser'@'localhost' identified by 'password'; grant all on testdb.* to 'testuser' identified by 'password';
sudo yum update:更新yum软件
yum update -y 不用按确定一直跟新的
rpm -e 软件包:卸载软件包
rpm -e --nodeps:强制卸载
查看mysql的安装情况
rpm -qa | grep -i mysq
卸载:
1.普通卸载(可能有依赖关系)
rpm -e mysql-community-libs-5.7.18-1.el6.x86_64
2.强制卸载
rpm -e --nodeps mysql-community-libs-5.7.18-1.el6.x86_64
删除mysql服务
[root@localhost
local]# chkconfig --list | grep -i mysql
[root@localhost local]# chkconfig --del mysql
在Linux系统下,通过命令“rm -rf”可以将任何数据直接从硬盘删除,并且没有任何提示
删除分散mysql文件夹
[root@localhost local]# whereis mysql 或者 find / -name mysql
mysql: /usr/lib/mysql /usr/share/mysql
清空相关mysql的所有目录以及文件
rm -rf /usr/lib/mysql
rm -rf /usr/share/mysql
rm -rf /usr/my.cnf
下面成功安装mysql服务详细步骤
1.Update your system:
sudo yum update
2.Install and Start MySQL
(1)Install MySQL and tell it which runlevels to start on:
sudo yum install mysql-server sudo /sbin/chkconfig --levels 235 mysqld on
(2)Then to start the MySQL server:
sudo service mysqld start
3.set password
sudo mysql_secure_installation
回车,回车跳过初始密码
设置新的密码
4.登录mysql
mysql -u root -p
Create a New MySQL User and Database
In the example below, testdbis
the name of the database,
testuseris
the user, and
passwordis
the user’s password.
create database testdb; create user 'testuser'@'localhost' identified by 'password'; grant all on testdb.* to 'testuser' identified by 'password';
You can shorten this process by creating the user while assigning database permissions:
create database testdb; grant all on testdb.* to 'testuser' identified by 'password';
Then exit MySQL.
Create a Sample Table
mysql -u testuser -p
use testdb;create table customers (customer_id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, first_name TEXT, last_name TEXT);
重置密码:
If you forget your root MySQL password, it can be flushed and then reset.
Stop the current MySQL server instance, then restart it with an option to not ask for a password.
sudo /etc/init.d/mysqld stop sudo mysqld_safe --skip-grant-tables &
Reconnect to the MySQL server with the MySQL root account.
mysql -u root
Use the following commands to reset root’s password.
Replace
passwordwith
a strong password.
use mysql; update user SET PASSWORD=PASSWORD("password") WHERE USER='root'; flush privileges; exit
Then restart MySQL.
sudo service mysqld restart
关于数据库乱码问题:
查看数据库字符集
SHOW VARIABLES LIKE 'character%';
上面是正确的编码
刚开始可能是latint1,全部修改成你需要的编码
#vim /etc/mysql/my.cnf (5.5以前系统)如下修改:
在【client】下面加入 default-character-set=utf8
在【mysqld】下面加入default-character-set=utf8
Notice:注意 如果修改后不能启动报错试试把default-character-set=utf8改为character_set_server=utf8,仅仅加入到mysqld下面的.client就不需要加了
#vim /etc/mysql/my.cnf 。(5.5以后系统)如下修改:
[client]
default-character-set=utf8
[mysqld]
default-storage-engine=INNODB
character-set-server=utf8
collation-server=utf8_general_ci
卸载:参考:http://blog.csdn.net/rosten/article/details/25096159
安装:参考:https://www.linode.com/docs/databases/mysql/how-to-install-mysql-on-centos-6
相关文章推荐
- 【关于Windows远程Linux中安装的mysql不能连接的问题】【ERROR:2003】
- linux下的安装mysql与遇到一些常见问题的解决方法
- 关于Linux下安装VMware Tools的一些问题
- linux下关于yum安装mysql卸载后遇到问题
- 关于在 win2000 下安装 mysql 的一些问题!
- 关于在linux上安装mysql的问题
- Linux 二进制包安装MySQL的一些问题
- 关于mysql5.6.20的一些安装问题
- 关于Linux安装python画图遇到的一些问题总结
- 关于安装mysql 5.7时遇到的默认root无法登陆或者找不到data文件夹的问题的一些解决办法
- Linux下安装mysql遇到的一些问题及解决办法
- 浅谈Linux 二进制包安装MySQL的一些问题
- 关于mysql安装的一些小问题
- Linux 安装 MySQL 以及 一些常见问题解决方案
- 关于一些Linux SVN的安装使用
- 关于Linux下VNC的安装和使用的问题 ZT
- [linux] 关于 YUM 的升级安装问题
- 关于VMware6.5下Ubuntu9.04安装VMware tools的一些问题总结
- 关于MySQL 最后一部安装阶段无法响应的问题
- 关于linux操作系统安装时电源管理的问题