GVKun编程网logo

MySQL 使用中遇到的 error(mysql-error)

33

本篇文章给大家谈谈MySQL使用中遇到的error,以及mysql-error的知识点,同时本文还将给你拓展Docker使用札记-使用中遇到的问题总结、Electron使用中遇到的问题、git使用中遇

本篇文章给大家谈谈MySQL 使用中遇到的 error,以及mysql-error的知识点,同时本文还将给你拓展Docker使用札记 - 使用中遇到的问题总结、Electron使用中遇到的问题、git使用中遇到的问题、L(A/N)MP 中遇到的MySQL的坑等相关知识,希望对各位有所帮助,不要忘了收藏本站喔。

本文目录一览:

MySQL 使用中遇到的 error(mysql-error)

MySQL 使用中遇到的 error(mysql-error)

  • eclipse 连接不上数据库
//加载驱动
        //oracal.jdbc.drive.Oracle.Driver
        //com.mysql.jdbc.Driver
        try {
            Class.forName("com.mysql.jdbc.Driver");
        } catch (ClassNotFoundException e) {
    
            e.printStackTrace();
        }
        Connection connection = null;
        try {
            connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/superlee", "Lee", "6666");
        } catch (SQLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        System.out.println(connection);

error:

 

 

 

错误原因: 连接的数据库名错误或连接的数据库未创建(不存在)。

Docker使用札记 - 使用中遇到的问题总结

Docker使用札记 - 使用中遇到的问题总结

1. 启动容器时报错误“: No such file or directory”

一般来说作为容器应用的入口都是entrypoint.sh文件,也就是Dockerfile最后一条指令为是:

ENTRYPOINT ["/entrypoint.sh"]

 

开始以为是修改的部分哪里不对,将内部内容改为只有一行命令:

date && pwd

  

重新构建并启动容器,仍然不行。网上有说是文件权限的,但是由于Windows系统将文件放入Linux镜像中是默认加了执行权限(+x),详细解释可参看这里。

原文:

That warning was added, because the Windows filesystem does not have an option to mark a file as ''executable''. Building a linux image from a Windows machine would therefore break the image if a file has to be marked executable.

For that reason, files are marked executable by default when building from a windows client; the warning is there so that you are notified of that, and (if needed), modify the Dockerfile to change/remove the executable bit afterwards.

所以这解释跳过。

后面在SO看到一条回答才猛然醒悟,这个问题每次在Windows上编写shell脚本经常遇到。问题就出在换行符上,将CRLF改为LF,保持再次构建并启动容器,问题得到解决。

 2. 在使用Docker-compose中使用MySQL时,没有按预期创建数据库,用户等信息

在设置了所需的环境变量MYSQL_DATABASE等没有按预期创建数据库等信息:

mysql:
     image: mysql:5.7
     volumes:
       - dbdata:/var/lib/mysql
     restart: always
     environment:
       MYSQL_ROOT_PASSWORD: test
       MYSQL_DATABASE: test
       MYSQL_USER: test
       MYSQL_PASSWORD: test  

 进过多次实验和查询得知原来是由于其中的volumes项导致的,当然并不是不能使用该项,而且非常有必要。原因出在之前构建时使用的volume中已经存在MySQL文件,则上述的环境变量不再生效,需要删掉volume,删掉后重新创建启动即可:

docker volume ls //获得相应的volume名称
docker volume rm project_db 

或者:

docker-compose down //停掉当前项目的服务
docker volume prune //删除所有未使用的volume

然后重建并重启服务:

docker up -d

更多详情请参看这里。

 

  

 

Electron使用中遇到的问题

Electron使用中遇到的问题

1.引入jquery和bootstrap的时候报错 Uncaught Error: Bootstrap''s JavaScript requires jQuery  或者 Uncaught ReferenceError: $ is not defined

解决方案:底层是因为node和jquery冲突了。这里只说解决方法,在index.html中引入jquery和bootstrap前先引入下列代码

<script>
      window.nodeRequire = require;
      delete window.require;
      delete window.exports;
      delete window.module;
    </script>

最终结果代码如下,就可以正常运行操作jquery等了

<html>
  <head>
    <meta charset="UTF-8">
    <title>Hello World!</title>
    <link href="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
  </head>
  <body>
    <h1 id="hh">这样就可以啦</h1>
    <!-- All of the Node.js APIs are available in this renderer process. -->
    We are using Node.js <script>document.write(process.versions.node)</script>,
    Chromium <script>document.write(process.versions.chrome)</script>,
    and Electron <script>document.write(process.versions.electron)</script>.
    <script>
      window.nodeRequire = require;
      delete window.require;
      delete window.exports;
      delete window.module;
    </script>
    <script src="http://cdn.static.runoob.com/libs/jquery/2.1.1/jquery.min.js"></script>
    <script src="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <script src="./renderer.js">
       console.log($(''#hh'').text());
    </script>
  </body>
</html>

 

git使用中遇到的问题

git使用中遇到的问题

git使用ssh地址无法拉分支,而http可以拉分支的问题

拉分支的时候这样的ssh地址无法下载,需要切换到http分支,进行下载

git@gitlab.abc.cn:core-group-dev/abc.git

http://gitlab.abc.cn/core-group-dev/abc-core-parent.git

这种问题是由于添加ssh key时指定了文件的名称,没有使用默认的名称导致无法找到本地对应的文件

方法:删除gitlab上对应的sshkey然后重新生成

可以使用 ssh -T git@gitlab.wm.com 进行检查

 

 

Push failed: Failed with error: Could not read from remote repository. 权限问题

Push failed: Failed with error: unable to access ''http://gitlab.puhuitech.cn/core-group-dev/puhui-core-parent.git/'': The requested URL returned error: 403 需要用ssh的安全方式去访问,重新用ssh地址拉取分支。

 

git分支的操作

git 新建分支git branch abc

git删除本地分支 git branch -a 查看所有分支

删除

git branch -d

报错:Cannot delete branch ''asset_req_4034_fp'' checked out 不能删除当前的分支

如何将master合并到新建的分支,idea中先切换到指定分支,然后选主干中的merge

Merged master to asset_req_4034_kx

 

 

 

 

 

 

 

 

L(A/N)MP 中遇到的MySQL的坑

L(A/N)MP 中遇到的MySQL的坑

1.登录phpmyadmin 账号密码正确,提示以上错误信息。

    phpMyAdmin - 错误

    配置文件权限错误,不应任何用户都能修改!

解决方法:查看了一下phpmyadmin 权限是777 .

phpmyadmin必须在755权限下才可以运行。
chmod -cR 755 phpMyAdmin (解决)

-------------------------------------分割线-----------------------------------------

发现CentOS7开关防火墙的命令service iptables save报错,使用原始命令开关:

systemctl stop firewalld
systemctl mask firewalld

Then, install the iptables-services package:

yum install iptables-services

Enable the service at boot-time:

systemctl enable iptables

Managing the service

systemctl [stop|start|restart] iptables

Saving your firewall rules can be done as follows:

service iptables save

or

/usr/libexec/iptables/iptables.init save

也可以安装的方式。

 

------------------------------------分割线----------------------------------------------------

use mysql

GRANT ALL PRIVILEGES ON *.* TO ''root''@''%'' IDENTIFIED BY ''mysql'' WITH GRANT OPTION;

flush privileges;

设置mysql远程登录,上面第二句是:设置root用户任何主机都可以登录并使用“mysql”的密码登录。

 

------------------------------------分割线----------------------------------------------------

 

 

 

 

今天关于MySQL 使用中遇到的 errormysql-error的介绍到此结束,谢谢您的阅读,有关Docker使用札记 - 使用中遇到的问题总结、Electron使用中遇到的问题、git使用中遇到的问题、L(A/N)MP 中遇到的MySQL的坑等更多相关知识的信息可以在本站进行查询。

本文标签: