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>
相关推荐
一 乐3 小时前
宠物管理|宠物店管理|基于SSM+vue的宠物店管理系统(源码+数据库+文档)
java·前端·数据库·vue.js·论文·毕设·宠物
gAlAxy...3 小时前
面试JAVASE基础(五)——Java 集合体系
java·python·面试·1024程序员节
二进制_博客3 小时前
sqoop从hive导出mysql常见错误汇总
hive·mysql·sqoop
王同学_1163 小时前
Linux系统端口关闭并排查相关自启动项(麒麟环境)
linux·运维·服务器
ceclar1233 小时前
C++容器list
java·c++·list
大聪明-PLUS4 小时前
Linux 中的 DNS 工作原理(二):各级 DNS 缓存
linux·嵌入式·arm·smarc
张较瘦_4 小时前
[论文阅读] 从 5MB 到 1.6GB 数据:Java/Scala/Python 在 Spark 中的性能表现全解析
java·python·scala
阿杰AJie4 小时前
数据库id生成方案
后端·mysql
Xiaoweidumpb4 小时前
Linux Docker docker-compose 部署python脚本
linux·python·docker