JAVA1026 方法;类:抽象类、抽象类继承;接口、接口继承 Linux:Mysql

Java

方法

格式

java 复制代码
修饰符 返回值类型 方法名(参数类型1 参数名1, 参数类型2 参数名2, ...) {
    // 方法体:具体的执行代码
    return 返回值; // 如果返回值类型不是void,则必须使用return语句
}
java 复制代码
public abstract class sabszijixie {

    public abstract  void gotoschooll();
    class students{
        private  String name;
                students(String name)
                {this.name=new String(name);}

    }
    public void workhradly(Object o){
    gotoschooll();
    students k=new students("xiaocao");
    students cc=k;
    k.name="caoxiao";
    System.out.println(cc.name);
    }

    public static void main(String[] args){
        workhradly(null);
    }
}

D:\新建文件夹\java1024\sabszijixie.java:19:9

java: 无法从静态上下文中引用非静态 方法 workhradly(java.lang.Object)
如何运行一个项目里单个.java程序,直接点击运行整个项目就开了









抽象类

java 复制代码
public abstract class sabszijixie {

    public static  void gotoschooll(){}

    static class students{
        private  String name;
                students(String name)
                {this.name=new String(name);}

    }
    public abstract void playwar3();
//抽象方法不是不能写方法体吗?哦 继承时具体写
    public static void workhradly(Object o){
    gotoschooll();
    students k=new students("xiaocao");
    students cc=k;
    k.name="caoxiao";
    System.out.println(cc.name);
    }
public void play(Object o){
        playwar3();

}
    public  static void main(String[] args){
        workhradly(null);
    }
}

继承抽象类

强制实现抽象类的抽象方法

java 复制代码
public class sabszijixieextends extends sabszijixie{
    @Override
    public void playwar3() {

    }
}

抽象类

java 复制代码
public abstract class sabszijixie {

    public static  void gotoschooll(){}

class students{
        private  String name;
                students(String name)
                {this.name=new String(name);}


    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}

    public abstract void playwar3();
//抽象方法不是不能写方法体吗?哦 继承时具体写
    public static void workhradly(Object o){

    }
public void play(Object o){
        playwar3();
    System.out.println("123");
}
    public   void main(String[] args){
        workhradly(null);
//        gotoschooll();
     students k=new students("xiaocao");
//k是一个实例,属性是xiaocao 使用方法 k.属性 k.方法调用
//        students cc=k;
//        k.name="caoxiao";
        System.out.println(k.getName());
    }
}
// ctrl / 一键/
// 类名首字母大写 命名驼峰命名法
// static 加载速度大于非static

抽象类继承

java 复制代码
public class test {
    public static void main(String[] args) {
        sabszijixieextends s =new sabszijixieextends();
        s.play(null);
        s.main(null);
    }

}

接口

java 复制代码
public interface boy {
    public void playLol();
    public void think();
    public void enjoylonely();
}

接口继承

java 复制代码
public class boyiml implements boy{
    @Override
    public void playLol() {

    }

    @Override
    public void think() {

    }

    @Override
    public void enjoylonely() {

    }
}

Linux

bash 复制代码
[caozx26@client ~]$ mysqladmin password 'root' -p
Enter password:
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'caozx26'@'localhost' (using password: YES)'
bash 复制代码
[root@client caozx26]# mysqladmin password 'root' -p
bash: mysqladmin: 未找到命令...
bash 复制代码
caozx26@192.168.235.200's password:
     ┌────────────────────────────────────────────────────────────────────┐
     │                        • MobaXterm 20.0 •                          │
     │            (SSH client, X-server and networking tools)             │
     │                                                                    │
     │ ➤ SSH session to caozx26@192.168.235.200                           │
     │   • SSH compression : ✘                                            │
     │   • SSH-browser     : ✔                                            │
     │   • X11-forwarding  : ✔  (remote display is forwarded through SSH) │
     │   • DISPLAY         : ✔  (automatically set on remote server)      │
     │                                                                    │
     │ ➤ For more info, ctrl+click on help or visit our website           │
     └────────────────────────────────────────────────────────────────────┘

Last login: Thu Oct 23 20:13:43 2025 from 192.168.235.1
[caozx26@client ~]$ mysql -uroot -p123
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.7.31 MySQL Community Server (GPL)

Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> exit
Bye
[caozx26@client ~]$ mysql -S /tmp/mysql.sock -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.7.31 MySQL Community Server (GPL)

Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> ^C
mysql> exit
Bye
[caozx26@client ~]$ mysql -e "show databases;" -uroot -p
Enter password:
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
[caozx26@client ~]$ mysql -e "show databases;" -uroot -e
mysql: [ERROR] mysql: option '-e' requires an argument
[caozx26@client ~]$ mysql -e "show databases;" -uroot -p
Enter password:
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
[caozx26@client ~]$ mysqladmin password '新密码' -p
Enter password:
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'caozx26'@'localhost' (using password: YES)'
[caozx26@client ~]$ mysqladmin password '111' -p
Enter password:
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'caozx26'@'localhost' (using password: YES)'
[caozx26@client ~]$ mysqladmin password 'root' -p
Enter password:
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'caozx26'@'localhost' (using password: YES)'
[caozx26@client ~]$ mysqladmin password 'root' -p
Enter password:
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'caozx26'@'localhost' (using password: YES)'
[caozx26@client ~]$ mysqladmin password 'root' -p
Enter password:
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'caozx26'@'localhost' (using password: YES)'
[caozx26@client ~]$ mysqladmin password 'root' -p
Enter password:
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'caozx26'@'localhost' (using password: YES)'
[caozx26@client ~]$ sudo su
[sudo] caozx26 的密码:
[root@client caozx26]# mysqladmin password 'root' -p
bash: mysqladmin: 未找到命令...
[root@client caozx26]# mysqladmin password 'root' -p
bash: mysqladmin: 未找到命令...
[root@client caozx26]# mysqladmin password 'root' -p
bash: mysqladmin: 未找到命令...
[root@client caozx26]# which mysqladmin
/usr/bin/which: no mysqladmin in (/sbin:/bin:/usr/sbin:/usr/bin)
[root@client caozx26]# bin/mysqladmin version -p
bash: bin/mysqladmin: 没有那个文件或目录
[root@client caozx26]# cd /mysql_3306/
[root@client mysql_3306]# bin/mysqladmin version -p
Enter password:
bin/mysqladmin  Ver 8.42 Distrib 5.7.31, for linux-glibc2.12 on x86_64
Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Server version          5.7.31
Protocol version        10
Connection              Localhost via UNIX socket
UNIX socket             /tmp/mysql.sock
Uptime:                 2 days 19 hours 45 min 3 sec

Threads: 1  Questions: 20  Slow queries: 0  Opens: 107  Flush tables: 1  Open tables: 100  Queries per second avg: 0.000
[root@client mysql_3306]# netstat -tnlp |grep 3306
tcp6       0      0 :::3306                 :::*                    LISTEN      75205/mysqld
[root@client mysql_3306]# bin/mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 15
Server version: 5.7.31 MySQL Community Server (GPL)

Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> set password=password('456')
    -> ;
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
mysql> ^C
mysql> exit
Bye
[root@client mysql_3306]# vim /mysql_3306/my.cnf
[root@client mysql_3306]# cat my.cnf
[mysqld]
basedir=/mysql_3306
datadir=/mysql_3306/data
socket=/tmp/mysql.sock
validate_password=OFF
[root@client mysql_3306]# service mysql_3306 restart
Shutting down MySQL.. SUCCESS!
Starting MySQL. SUCCESS!
[root@client mysql_3306]# mysql -uroot -p
bash: mysql: 未找到命令...
[root@client mysql_3306]# bin/mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.31 MySQL Community Server (GPL)

Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> set password=password('456');
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql>
相关推荐
武子康1 分钟前
Java-171 Neo4j 备份与恢复 + 预热与执行计划实战
java·开发语言·数据库·性能优化·系统架构·nosql·neo4j
m0_6398171516 分钟前
基于springboot火锅店管理系统【带源码和文档】
java·spring boot·后端
MasterLi802331 分钟前
我的读书清单
android·linux·学习
赵渝强老师35 分钟前
【赵渝强老师】MySQL集群解决方案
数据库·mysql
ha20428941941 小时前
Linux操作系统学习之---初识网络
linux·网络·学习
飞凌嵌入式1 小时前
【玩转多核异构】T153核心板RISC-V核的实时性应用解析
linux·嵌入式硬件·嵌入式·risc-v
陌路201 小时前
Linux 34TCP服务器多进程并发
linux·服务器·网络
玉树临风江流儿1 小时前
Linux驱动开发实战指南-中
linux·驱动开发
会编程的林俊杰1 小时前
SpringBoot项目启动时的依赖处理
java·spring boot·后端
李慕婉学姐1 小时前
【开题答辩过程】以《Javaweb的火花流浪动物救助系统设计与实现》为例,不会开题答辩的可以进来看看
vue.js·spring boot·mysql