云服务器 Centos7.0 部署

时间:2023-03-09 01:31:15
云服务器 Centos7.0 部署

CentOS安装jdk的三种方法

http://www.mamicode.com/info-detail-613410.html

centos Linux下安装Tomcat和发布Java的web程序

http://www.phperz.com/article/14/1018/29711.html

windows终止进程的两种方式:

1、ntsd -c q -p 2660

2、taskkill /PID 2660

2660是pid   打开任务管理器---->进程------->查看------->选择列PID

腾讯云CentOS7.0使用yum安装mysql

http://www.bitscn.com/pdb/mysql/201512/605370.html

http://www.th7.cn/db/mysql/201511/144410.shtml

查看http://repo.mysql.com选择合适的
wget http://repo.mysql.com/mysql-community-release-el7-7.noarch.rpm
sudo rpm -ivh mysql-community-release-el7-5.noarch.rpm

sudo rpm -ivh mysql-community-release-el7-5.noarch.rpm
y

其他一致
随笔- 89  文章- 18  评论- 21 

CentOS 7.0下MySQL忘记root密码解决方法

# vim /etc/my.cnf 
在[mysqld]的段中加上一句:skip-grant-tables 
例如: 
[mysqld] 
datadir=/var/lib/mysql 
socket=/var/lib/mysql/mysql.sock 
skip-grant-tables 
保存并且退出vi。

重新启动mysqld 
# service mysqld restart

登录并修改MySQL的root密码 
# mysql 
Welcome to the MySQL monitor. Commands end with ; or \g. 
Your MySQL connection id is 3 to server version: 3.23.56 
Type 'help;' or '\h' for help. Type '\c' to clear the buffer. 
mysql> USE mysql ; 
Database changed 
mysql> UPDATE user SET Password = password ( 'new-password' ) WHERE User = 'root' ; 
Query OK, 0 rows affected (0.00 sec) 
Rows matched: 2 Changed: 0 Warnings: 0 
mysql> flush privileges ; 
Query OK, 0 rows affected (0.01 sec) 
mysql> quit

# vim /etc/my.cnf 
将刚才在[mysqld]的段中加上的skip-grant-tables删除 
保存并且退出vim

重新启动mysqld 
# service mysqld restart

CentOS 7.0下Mysql数据库误删root用户:

修改/etc/my.conf文件,添加skip-grant-tables

重新启动mysqld 
# service mysqld restart 

使用下列命令登陆mysql,无需密码

mysql

登陆后,重新添加root用户

use mysql;

insert into user set user='root',ssl_cipher='',x509_issuer='',x509_subject='';

update user set Host='localhost',select_priv='y', insert_priv='y',update_priv='y', Alter_priv='y',delete_priv='y',create_priv='y',drop_priv='y',reload_priv='y',shutdown_priv='y',Process_priv='y',file_priv='y',grant_priv='y',References_priv='y',index_priv='y',create_user_priv='y',show_db_priv='y',super_priv='y',create_tmp_table_priv='y',Lock_tables_priv='y',execute_priv='y',repl_slave_priv='y',repl_client_priv='y',create_view_priv='y',show_view_priv='y',create_routine_priv='y',alter_routine_priv='y',create_user_priv='y' where user='root';
quit;

使用下列命令重新登陆, 设置root的密码

mysql -u root
use mysql;
update user set password=password('yourrootpasswd') where user='root';
update user set host = '%' where user = 'root'; #设置远程机器可访问mysql,如果不需要可不是设置
flush privileges;
quit;

修改/etc/my.conf文件,将skip-grant-tables去掉,然后重启mysql