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>
相关推荐
二哈赛车手7 小时前
新人笔记---ApiFox的一些常见使用出错
java·笔记·spring
wj3055853787 小时前
课程 9:模型测试记录与 Prompt 策略
linux·人工智能·python·comfyui
栗子~~7 小时前
JAVA - 二层缓存设计(本地缓冲+redis缓冲+广播所有本地缓冲失效) demo
java·redis·缓存
abigriver7 小时前
打造 Linux 离线大模型级语音输入法:Whisper.cpp + 3090 显卡加速与 Rime 中英混输终极调优指南
linux·运维·whisper
YDS8298 小时前
DeepSeek RAG&MCP + Agent智能体项目 —— RAG知识库的搭建和接口实现
java·ai·springboot·agent·rag·deepseek
wangqiaowq8 小时前
windows下nginx的安装
linux·服务器·前端
rising start8 小时前
二、全面理解MySQL架构
mysql·架构
YYRAN_ZZU8 小时前
Petalinux新建自动脚本启动
linux
bqq198610269 小时前
MySQL性能优化
mysql·mysql优化
charlie1145141919 小时前
嵌入式Linux驱动开发pinctrl篇(1)——从寄存器到子系统:驱动演进之路
linux·运维·驱动开发