GVKun编程网logo

ERROR 1290 (HY000): The MySQL server is running with the --s_MySQL

2

关于ERROR1290(HY000):TheMySQLserverisrunningwiththe--s_MySQL的问题就给大家分享到这里,感谢你花时间阅读本站内容,更多关于Cursorfastex

关于ERROR 1290 (HY000): The MySQL server is running with the --s_MySQL的问题就给大家分享到这里,感谢你花时间阅读本站内容,更多关于Cursor fastexecutemany error: ('HY000', '[HY000] [Microsoft][SQL Server Native Client 11.0]Unicode 转换失败 (0) (SQLExecute)')、docker-compose run mysql: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)、ERROR 1290 (HY000) 解决办法、ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cann...等相关知识的信息别忘了在本站进行查找喔。

本文目录一览:

ERROR 1290 (HY000): The MySQL server is running with the --s_MySQL

ERROR 1290 (HY000): The MySQL server is running with the --s_MySQL

出现如题目所示的问题运行下面语句:

mysql>flush privileges;


Cursor fastexecutemany error: ('HY000', '[HY000] [Microsoft][SQL Server Native Client 11.0]Unicode 转换失败 (0) (SQLExecute)')

Cursor fastexecutemany error: ('HY000', '[HY000] [Microsoft][SQL Server Native Client 11.0]Unicode 转换失败 (0) (SQLExecute)')

如何解决Cursor fastexecutemany error: (''HY000'', ''[HY000] [Microsoft][SQL Server Native Client 11.0]Unicode 转换失败 (0) (SQLExecute)'')?

我正在尝试使用游标 fast_executemany 将几个大型 csv 文件上传到 sql server 数据库。下面是代码示例。

  if item.endswith(zip_ext):
      file_name = os.path.abspath(item)
      zip_ref = zipfile.ZipFile(file_name)
      zip_ref.extractall(directory)
      zip_ref.close()
      os.remove(file_name)

for item in os.listdir(directory): # Load and Edit CSV
   if item.endswith(ext):
       df = pd.read_csv(item)
       df.rename(columns={df.columns[0]:''InvoiceNo'',df.columns[2]:''OrderNo'',df.columns[20]:''Syscode'',df.columns[27]:''SpotDate'',df.columns[28]:''Network'',df.columns[30]:''Spottime'',df.columns[29]:''SpotLength'',df.columns[31]:''Program'',df.columns[32]:''SpotName'',df.columns[21]:''Source''},inplace=True)
      
       df[''BillDate'']=''2021-03-01'' # Enter Preferred Bill Date Here!
       df[''FileName'']=str(item)
       df[[''SpotDate'',''BillDate'',''Spottime'']]=df[[''SpotDate'',''Spottime'']].apply(pd.to_datetime)
       df[''Spottime'']=df[''Spottime''].dt.time
       df[''OrderNo'']=df[''OrderNo''].apply(lambda x: '''' if x == ''NULL'' else x)
       df = df[[''InvoiceNo'',''OrderNo'',''Syscode'',''SpotDate'',''Network'',''Spottime'',''SpotLength'',''Program'',''SpotName'',''Source'',''FileName'']]
       
# Connect to sql Server
       conn = pyodbc.connect(''DRIVER=sql Server Native Client 11.0;''
                             ''SERVER=PWDBS006sql;'' #UPDATED 2/4/21
                             ''DATABASE=Marketing Cross-Channel Affidavits;''
                             ''Trusted_Connection=yes;'',autocommit=True)
       crsr = conn.cursor()
       crsr.fast_executemany = False
       
# Insert Df to sql
       sql_statement = ''''''INSERT INTO dbo.SpectrumReach_Marketing (InvoiceNo,OrderNo,BillDate,Syscode,SpotDate,Network,Spottime,SpotLength,Program,SpotName,Source,FileName)
                        VALUES (?,?,?)''''''
       list_of_tuples = list(df.itertuples(index=False))
       crsr.executemany(sql_statement,list_of_tuples)
       
       crsr.close()
       conn.close() 

运行此代码时,我收到错误消息:(''HY000'',''[HY000] [Microsoft][sql Server Native Client 11.0]Unicode 转换失败 (0) (sqlExecute)''。

我已经将此代码用于来自几个来源的几个大型数据集,它们的格式应该完全相同,并且它有效,但对于特定供应商,它会中断并显示上述错误。此外,当我有 fast_executemany = False 时,此代码会运行,但由于我尝试传输的文件的大小,让数据上传这么慢是不可行的。

任何帮助将不胜感激!

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

docker-compose run mysql: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

docker-compose run mysql: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

如何解决docker-compose run mysql: ERROR 2002 (HY000): Can''t connect to local MySQL server through socket ''/var/run/mysqld/mysqld.sock'' (2)

连续工作 14 小时后我完全被烤焦了,即使在整个互联网上爬行后我也无法解决这个问题。

场景很简单:

我有一个 docker-compose.yml,其中包含安装和部署应用程序所需的许多服务,其中包括一个简单的 MysqL 5 服务:

  (...)
  MysqL:
    environment:
      MysqL_ALLOW_EMPTY_PASSWORD: "yes"
      MysqL_ROOT_PASSWORD: 
    image: MysqL:5
    restart: always
    volumes:
      - .MysqL:/var/lib/MysqL
  (...)

现在我只想在部署应用程序之前创建初始数据库,使用一个简单的:

docker-compose run MysqL MysqL -e "CREATE DATABASE IF NOT EXISTS database"

但是无论我怎么尝试,都会出现这个错误:

Creating network "app_default" with the default driver
Creating app_MysqL_run ... done
ERROR 2002 (HY000): Can''t connect to local MysqL server through socket ''/var/run/MysqLd/MysqLd.sock'' (2)

我也试过(没有成功/有同样的错误信息):

docker-compose up -d MysqL
docker-compose exec MysqL MysqL -e "CREATE DATABASE IF NOT EXISTS database"

唯一有效的是进入容器并手动执行exact(!) same(!)命令。但我绝对需要自动化。

我错过了什么?任何形式的帮助都非常感谢!

解决方法

结果 docker-compose rundocker-compose exec 覆盖了 Dockerfile 的命令,因此 mysqld 永远不会启动。传递 mysqld && mysql -e "CREATE DATABASE database" 不起作用,在 docker-compose exec 之后运行 docker-compose up 将导致竞争条件。

我最终得到了适合我需求的以下解决方案:

docker-compose run mysql && \\
docker-compose exec mysql /bin/bash -c "while ! mysql -e \\"CREATE DATABASE IF NOT EXISTS database\\" &> /dev/null; do sleep 1; done"

这将在子容器上循环命令,直到主机容器准备就绪。此外,IF NOT EXISTS 在这里很重要,否则如果数据库已经存在,可能会陷入死锁。

ERROR 1290 (HY000) 解决办法

ERROR 1290 (HY000) 解决办法

select * into outfile ''/home/update_testdbtest.txt'' from update_test;

ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot execute this statement

MysqL> select * from update_test;

+------+-------+

| id   | name  |

+------+-------+

|    1 | hello |

|    2 | world |

+------+-------+

2 rows in set (0.00 sec)


MysqL> show variables like ''%secure%''

    -> ;

+--------------------------+-----------------------+

| Variable_name            | Value                 |

+--------------------------+-----------------------+

| require_secure_transport | OFF                   |

| secure_auth              | ON                    |

| secure_file_priv         | /var/lib/MysqL-files/ |

+--------------------------+-----------------------+

3 rows in set (0.01 sec)


MysqL> select * into outfile ''/var/lib/MysqL-files/update_testdbtest.txt'' from update_test;

Query OK, 2 rows affected (0.00 sec)


ERROR 1290 (HY000):   The MySQL server is running with the --skip-grant-tables   option so it cann...

ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cann...

在给数据库设置用户时,

mysql> CREATE USER ''xxxx''@''localhost'' IDENTIFIED BY ''xxxx'';
Query OK, 0 rows affected (0.00 sec)//这是成功时候应出现的

结果输入第一行之后产生如题所示错误:

ERROR 1290 (HY000):      
The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement

上网百度解决方案:

mysql> flush privileges;  //直译:更新权限

就ok了

 

附带mysql的操作说明:

1.使用管理员权限打开命令提示符,步骤:开始菜单选择Windows系统 - 命令提示符 - 在其上点击右键选择 - 更多 - 以管
理员身份运行。(Windows PowerShell)

PS C:\Windows\system32> net start mysql         //输入这句话啊
MySQL 服务正在启动 .
MySQL 服务无法启动。

 2.cd 转到自己安装mysql的路径的bin目录(试试“cd..”),比如

C:\MySQL\mysql-5.7.20-winx64\bin>

3.进入mysql(输入密码)

C:\MySQL\mysql-5.7.20-winx64\bin>mysqladmin -u root -p password

 

Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.20
Copyright (c) 2000, 2017, 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>

 就可以进行操作了

退出可以直接

mysql>exit

 

更具体的去看老师给的文档

 

 

 

 

关于ERROR 1290 (HY000): The MySQL server is running with the --s_MySQL的问题就给大家分享到这里,感谢你花时间阅读本站内容,更多关于Cursor fastexecutemany error: ('HY000', '[HY000] [Microsoft][SQL Server Native Client 11.0]Unicode 转换失败 (0) (SQLExecute)')、docker-compose run mysql: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)、ERROR 1290 (HY000) 解决办法、ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cann...等相关知识的信息别忘了在本站进行查找喔。

本文标签: