linux下关于mysql安装的一些问题
来源:互联网 发布:大学生体育锻炼数据 编辑:程序博客网 时间:2024/06/12 00:48
安装mysql时候找不到密码尝试无果后开始卸载重装
create database testdb; create user 'testuser'@'localhost' identified by 'password'; grant all on testdb.* to 'testuser' identified by 'password';
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
删除分散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 update2.Install and Start MySQL
(1)Install MySQL and tell it which runlevels to start on:
sudo yum install mysql-serversudo /sbin/chkconfig --levels 235 mysqld on(2)Then to start the MySQL server:
sudo service mysqld start3.set password
sudo mysql_secure_installation回车,回车跳过初始密码
设置新的密码
4.登录mysql
mysql -u root -p
Create a New MySQL User and Database
In the example below,
testdb
is the name of the database,testuser
is the user, andpassword
is 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
重置密码:
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 password
with a strong password.
use mysql; update user SET PASSWORD=PASSWORD("password") WHERE USER='root'; flush privileges; exitThen 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
- linux下关于mysql安装的一些问题
- linux 下关于libxml2库的一些问题
- Linux环境下关于权限的一些小问题
- linux下关于mySQL的安装和配置
- Linux下关于环境变量的一些心得
- Linux下关于环境变量的一些心得
- Linux下关于环境变量的一些心得
- Linux下关于用户组的一些命令
- Mac下关于pygame安装的问题
- linux下关于结构体stat的一些应用
- linux下关于结构体stat的一些应用
- 0818-Linux下关于文件的一些操作
- Linux下关于查看操作系统信息的一些命令
- linux下关于调用动态库的一些总结
- linux下关于vim的一些小知识点总结
- windows下关于QT5连接mysql的几点问题
- windows下关于程序安装运行的权限问题
- 【Tomcat】Linux下关于Tomcat部署项目的问题总结
- 一道简单而又不简单的面试题
- 在iOS中创建React-Native页面,并跳转到原生页面
- Android线程池的使用
- 10603
- vue引入 jquery 插件
- linux下关于mysql安装的一些问题
- Android studio 2.2 logcat 不打印log的问题
- -----------------------python&Tensorflow分割线------------------
- qt 之绘制 圆弧(抽奖圆盘)
- 机器学习算法之SVM(1)结构风险最小化
- Listview的基础使用
- 在react-native的项目中跳转到原生iOS页面
- docker挂载
- Qt5.7+Opencv2.4.9人脸识别(四)模型训练